Windows Jenkins slave node unable to pull from git repo after the URL changed

176 Views Asked by At

We had to change our bitbucket URL after which Windows Jenkins slave node is unable to pull the git repo from the new bitbucket URL. It works fine on Mac /Linux. I have added / accepted the key for the new domain on windows nodes. It works fine when i clone the repo manually on the machine but fails when its done thru jenkins.

More info about the setup:

  • Jenkins is setup via ssh key authentication with the Windows slave node.
  • ssh agent Jenkins plugin is used for ssh authentication.
using credential 046a6520-abcd-abcd-abcd-abcdb1139e55
Fetching changes from the remote Git repository
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://git@bitbucket.<new url>.com/<project>/<repo>.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1002)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1244)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- ssh://git@bitbucket.<new url>.com/<project>/<repo>.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: No RSA host key is known for bitbucket.<new url>.com and you have requested strict checking.
Host key verification failed.
fatal: 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:2734)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)

Checks Done :

  • Verified that the correct ssh is loaded on the Windows node by using the command eval 'ssh-agent -s` ssh-add
  • Verified that the correct user context by running a script in the pipeline script { bat 'echo %USERNAME%' }
  • Restarted Windows node.
  • Ran these two commands to remove the configuration for the credential helper in Git
    git config --global --unset credential.helper
    git config --system --unset credential.helper
  • Reinstalled GIT and added it to the path.

Any help on this is really appreciated. Thank you.

0

There are 0 best solutions below