LLD
LLD

Reputation: 163

Jenkins unable to connect GIT repository: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

Hi my Jenkins instance is unable to connect to GIT repository although I googled a lot. Both Jenkins and GIT were installed on same CentOS server. This is the screenshot I got during pipeline set up:

enter image description here

I have done following:

  1. Make sure .ssh directory of GIT is of mode 700;
  2. Make sure .ssh/authorized_keys of GIT is of mode 600;
  3. Added Jenkins public key to .ssh/authorized_keys of GIT;
  4. Log in as Jenkins and execute 'git ls-remote -h :test.git HEAD' on command line - it will prompt for git password;
  5. Added git username/password to Jenkins under Credentials

Upvotes: 1

Views: 2565

Answers (1)

fredrik
fredrik

Reputation: 6638

Jenkins will not use the SSH Keys located on the master or slave that runs the job. So your setup with placing the keys in ~/.ssh and having a username/password credential set up on on the master will not work.

Instead you should create a set of credentials using the SSH Credential Plugin, where you can also specify the passphrase for the private key. The jobs then need to use this credential to connect to the repository.

Upvotes: 1

Related Questions