Jenkins Unable to Clone Stash Repository

Jeff Thomas Atlassian Team Oct 10, 2013

We're having trouble getting Jenkins to clone any of our Stash repositories over HTTP or HTTPS.

The URL in the Jenkins job is http://stash.company.com:7990/scm/project/repo.git, when the job is run, we get the following error in Jenkins:

Cloning repository http://stash.company.com:7990/scm/project/repo.git
git --version
git version 1.7.1
ERROR: Error cloning remote repo 'origin' : Could not clone http://stash.company.com:7990/scm/project/repo.git
hudson.plugins.git.GitException: Could not clone http://stash.company.com:7990/scm/project/repo.git
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:283)
	at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:46)
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
	at hudson.FilePath.act(FilePath.java:916)
	at hudson.FilePath.act(FilePath.java:889)
	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
	at hudson.model.Run.execute(Run.java:1665)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.plugins.git.GitException: Failed to connect to http://stash.company.com:7990/scm/project/repo.git
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1343)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1305)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:46)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:278)
	... 16 more
Trying next repository
ERROR: Could not clone repository
java.io.IOException: Could not clone
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1025)
	at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
	at hudson.FilePath.act(FilePath.java:916)
	at hudson.FilePath.act(FilePath.java:889)
	at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
	at hudson.model.Run.execute(Run.java:1665)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
	at hudson.model.ResourceController.execute(ResourceController.java:88)
	at hudson.model.Executor.run(Executor.java:246)
Finished: FAILURE

We require authentication for our repos and I'm currently trying to use a .netrc file to send the username and password. I've also tried passing the username and password in the URL (ie. http://user:pass@stash.company.com:7990/scm/project/repo.git).

Catalina.out for Jenkins seems to indicate that it's using an "Atlassian Stash" user.

Oct 10, 2013 4:10:13 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: basic authentication scheme selected
Oct 10, 2013 4:10:13 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: No credentials available for BASIC 'Atlassian Stash'@stash.company.com:7990

I am able to clone the repository from the command line running as the Jenkins user.

git clone http://stash.company.com:7990/scm/project/repo.git

What am I doing wrong?

1 answer

1 accepted

This widget could not be displayed.
Jeff Thomas Atlassian Team Oct 10, 2013

I turned on SSH in Stash and used that instead of HTTP, it's now working.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Teamwork

The tools we make for teams? We use them every day at Atlassian to get shit done (and it works).

I’m Jess, a Product Marketer for Jira Software Server and Data Center, and now a huge fan of our products. Read on for a 90 day, new-hire perspective on what it’s like to standardize on the Atlassian...

40 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you