Jenkins returned status code 128 with github

This error:

stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly

indicates that Jenkins is trying to connect to github with the wrong ssh key.

You should:

  1. Determine the user that jenkins runs as, eg. 'build' or 'jenkins'
  2. Login on the jenkins host that is trying to do the clone - that is, do not login to the master if a node is actually doing the build.
  3. Try you ssh to github - if it fails, then you need to add the proper key to <jenkins user home>/.ssh

To check are the following:

  1. if the right public key (id_rsa.pub) is uploaded to the git-server.
  2. if the right private key (id_rsa) is copied to /var/lib/jenkins/.ssh/
  3. if the known_hosts file is created inside ~/.ssh folder. Try ssh -vvv [email protected] to see debug logs. If thing goes well, github.com will be added to known_hosts.
  4. if the permission of id_rsa is set to 700 (chmod 700 id_rsa)

After all checks, try ssh -vvv [email protected].

Tags:

Github

Jenkins