Reputation: 553
Im trying to setup jekins with Git by ssh.
Standard execute:
git clone ssh://[username]@[server]/srv/git/[repo]
after putting password repositorium is cloned on my disk.
Now on jenkins
ssh://[username]@[server]/srv/git/[repo].git
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://[username]@[server]/srv/git/[repo].git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
or another way is
Upvotes: 4
Views: 10282
Reputation: 2103
In our environment, with multi slave configuration, the issue was with the master. Basically our slaves are configured to connect to git repo, but not the master, as we do not execute any jobs on master.
The above error is due to master trying to connect to your git repo. Hence, either make sure your master is configured properly to access your git repo, or just ignore this error and run your job to see if it executes fine on the slave.
Upvotes: 1
Reputation: 1
Just add password in the 'passphrase' section when you add ssh key, because you have the private key but it still needs password to connect to the repo.
Upvotes: -2
Reputation: 27812
I had the same error report while I was using credentials of kind "SSH Username with private key". For the private key, I selected "From a file on Jenkins master" and provided as file location ~/.ssh/some-project-specific-directory/id_rsa
.
It turned out that Jenkins version 1.637 has problems with the tilde home notation ("~
"). After I changed to the expanded absolute path (e.g. /var/lib/jenkins/.ssh/some-project-specific-directory/id_rsa
) everything worked well again.
Upvotes: 1
Reputation: 4445
You're connecting by SSH, which likely means you've got a key-based login set up so that you can connect without a password. (Move ~/.ssh/id_rsa to some other location, and I'm pretty sure you'll be asked for a password when you do a git clone as well.)
In this case the error is a result of Jenkins not having a similar private key setup. You have to generate a public/private key pair for jenkins, and add the public key to your git server, or add your private key to Jenkins.
Related question & answer: https://stackoverflow.com/a/8911280/223981
Upvotes: 1