Getting Started with Jenkins Part -3 🔑 Implementing SSH GitHub Credentials in Jenkins

Getting Started with Jenkins Part-3: Implementing SSH GitHub Credentials in Jenkins
Implementing SSH GitHub Credentials in Jenkins
generate a new SSH key on your local machine. After you generate the key, you can add the public key to your account on GitHub.com to enable authentication for Git operations over SSH.
- Open Terminal.
- Paste the text below, substituting in your GitHub email address.
ssh-keygen -t ed25519 -C "[email protected]"
You will then be asked to provide an optional passphrase. This can be used to make your key even more secure, but for this lesson you can skip it by hitting enter twice.
> Enter passphrase (empty for no passphrase):
> Enter same passphrase again:
When the key generation is complete, you should see the following confirmation:
Your identification has been saved in /root/.ssh/id_ed25519
Your public key has been saved in /root/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:bkvyj+VtdmB7XjT7OsxCcfJRs/i7T8jEE1QaVeelT7I [email protected]
The key's randomart image is:
+--[ED25519 256]--+
| ooB|
| . *+|
| *.=|
| oooB |
| S =Eoo|
| . +o.=o|
| . + .o =o.+|
| = = .= *+.|
| +.oo.=o+=|
+----[SHA256]-----+
Add your public key to GitHub
We now need to tell GitHub about your public key. Display the contents of your new public key file with cat
:
cat ~/.ssh/id_ed25519.pub
The output should look something like this:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFkbPJzhy8sG7SMrkK4SddXjwPRWdye5uG1FL7m4R8CI [email protected]
Copy the contents of the output to your clipboard.
Login to github.com and bring up your account settings by clicking the tools icon.

Name your key something whatever you like, and paste the contents of your clipboard into the Key text box.

Finally, hit Add key to save. Next go to "Jenkins Dashboard" -> "Manage Jenkins" -> "Credentials" -> "Add Credentials". Under the "Kind" field, click the drop-down and select "SSH Username with private key". Provide your username, private key and passphrase as follows:
