We will see how to connect to GitHub from Jenkins using SSH keys instead of using user name and password. It is also a good practice to use SSH keys in Jenkins jobs instead of using user name and password.
Watch the steps in YouTube channel:
Pre-requistes:
- Jenkins is up and running
- Credentials plug-in installed in Jenkins
Create SSH keys in your Jenkins EC2 instance
ssh-keygen
enter four times. this will create keys in .ssh folder.
Copy and paste the public key
sudo cat ~/.ssh/id_rsa.pub
Add public Keys into your respective GitHub
Add public keys into your Repository--> settings--> Deploy keys section
Add Private Keys in Jenkins Master
Login Jenkins. Go to Manage Jenkins. click on CredentialsClick on Jenkins
Click on Global Credentials
Choose SSH username with private key
username can be anything
Click on enter directly under private key option and Click Add
Copy and paste private key(not public key) of your from Jenkins instance. command is below:
sudo cat ~/.ssh/id_rsa
copy the content of whole output from above command.
sudo cat ~/.ssh/id_rsa
copy the content of whole output from above command.
Click OK to save.
Now go to any Jenkins Job, you can choose this option for checking out from GitHub. Make sure you enter SSH url not https url.
JavaScript is among the most favorable programming languages to learn for hobby projects and career/job perspectives. Make friends with JavaScript and advance your career as a JS developer. Either you are learning JavaScript afresh or brushing up your programming skills, you will find these ten hottest online JavaScript courses worth your time, effort, and money. free Oracle database courses
ReplyDelete