Reputation: 22966
When first attempting to check out my vsts git repo jenkins fails, however if I don't delete the workspace and run the jenkins build again it succeeds.
I've checked my credentials in settings and they haven't changed, Jenkins doesn't complain about not being able to access the repo from there.
If I do a clone in console separately it works fine.
This is the output I'm getting now:
Building in workspace G:\Program Files (x86)\Jenkins\workspace\Another Test Cloning the remote Git repository Cloning repository ssh://kintsugi@vs-ssh.visualstudio.com:22/DefaultCollection/_ssh/BadHombresGITSubmoduleEdition
git.exe init G:\Program Files (x86)\Jenkins\workspace\Another Test # timeout=10 Fetching upstream changes from ssh://kintsugi@vs-ssh.visualstudio.com:22/DefaultCollection/_ssh/BadHombresGITSubmoduleEdition git.exe --version # timeout=10 using GIT_SSH to set credentials git.exe fetch --tags --progress ssh://kintsugi@vs-ssh.visualstudio.com:22/DefaultCollection/_ssh/BadHombresGITSubmoduleEdition +refs/heads/:refs/remotes/origin/ ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress ssh://kintsugi@vs-ssh.visualstudio.com:22/DefaultCollection/_ssh/BadHombresGITSubmoduleEdition +refs/heads/:refs/remotes/origin/" returned status code 128: stdout: stderr: System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.52.8.37:22 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at Microsoft.TeamFoundation.Ssh.Server.External.Eldos.EldosSshCommandClient.ClientSocket_OnOpenConnection(IAsyncResult asyncResult) in D:\v2.0\A1_work\14\s\Tfs\Service\Ssh\External\Eldos\EldosSshCommandClient.cs:line 332fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:589) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1083) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123) at hudson.scm.SCM.checkout(SCM.java:495) at hudson.model.AbstractProject.checkout(AbstractProject.java:1212) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:566) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:491) at hudson.model.Run.execute(Run.java:1737) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:421) ERROR: Error cloning remote repo 'origin' Finished: FAILURE
Upvotes: 0
Views: 762
Reputation: 38136
Please trouble shooting the issue with below aspects:
For the local machine which you setup the jenkins server, you should add the SSH to VSTS account:
ssh-keygen
.id_rsa.pub
) to your VSTS account.URL
In the Source Code Management, input the URL with SSH URL with the format like:
ssh://account@vs-ssh.visualstudio.com:22/_ssh/project
ssh://account@vs-ssh.visualstudio.com:22/project/_ssh/repo
So you can use the URL as ssh://kintsugi@vsssh.visualstudio.com:22/_ssh/BadHombresGITSubmoduleEdition
.
Credentials
Do not add any credentials since the local machine already has the SSH key.
Branches
Specify the branch(es) to build, you can specify a certain branch name or leave it blank for building all branches.
Then the VSTS git repo should be cloned successful by SSH in Jenkins job.
Upvotes: 1