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

0 votes
Accepted answer
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
Posted Dec 07, 2018 in Off-topic

Friday Fun: Dry T-Shirt Competition - What's your BEST (Atlassian) T-Shirt!?

[Note: So it was my turn for Friday Fun and sadly I was sick thanks to rubbish sinus infection... so apologies to most of Europe and Asia for the delayed post. However, I finally got out of bed for t...

395 views 27 5
Join discussion

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