Running on a server running Red Hat Linux 9 (9.4). I am unable to use any valid SSH key to connect Jenkins to my Git repository.
The steps I took:
1.) I created the public and private key using ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
2.). I copied the public ssh key to my github account.
3.) I added github to my known hosts using ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
4.) I started an agent.
5.) I granted permissions to Jenkins using
# Set the permissions on the .ssh directory
chmod 700 .ssh
# Set the permissions on the private key
chmod 600 .ssh/id_rsa
# Set the permissions on the public key
chmod 644 .ssh/id_rsa.pub
# Optionally, set the permissions on the known_hosts file
chmod 644 .ssh/known_hosts
6.) ssh -T git@github.ibm.com
succeeds.
7.) I copied the private key to Jenkins.
Yet, for some reason, Jenkins fails to connect using the key. It says Permission denied (publickey)
If anyone. has any ideas as to why this is happening, I would be thankful to hear them. Thank you.