Jenkins Permission denied (publickey, gssapi-keyex, gssapi-with-mic, password)

In Jenkins, which is configured on a CentOS server, I am trying to connect to the git repository on another server using a username and password. Unfortunately, I get the following error:

Failed to connect to repository : Command "/usr/bin/git -c core.askpass=true ls-remote -h ssh:// root@ [ip addres]:2020/opt/gitrepo/enpapp.git HEAD" returned status code 128: stdout: stderr: Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). fatal: Could not read from remote repository.* Please make sure you have the correct access rights and the repository exists. 

I can connect to the git server using Putty.
I can also clone the git repository using Netbeans or the command line.

The resolution of the .ssh folder is 700, and the known_hosts is 644

+7
git ssh jenkins
source share
1 answer

(The command "/ usr / bin / git -c core.askpass = true ls-remote -h ssh: // root @ [ip addres]: 2020 / opt / gitrepo / enpapp.git HEAD")

From your logs, it’s clear that Jenkins is trying to connect to the server using ssh-keys

you can generate the correct keys using ssh-keygen and add the private key to your Jenkins credentials and the public key in your server account.

Better if you can share a screenshot of your jenkins work showing how it is configured. Jenkins git plugin does not support ssh username and password.
https://issues.jenkins-ci.org/browse/JENKINS-22909

0
source share

All Articles