It is a good practice to use SSH url in Jenkins jobs when configuring free style jobs. See below for the steps:
1. Go Jenkins. Click on your freestyle job, click on configure
2. Go to source code management, click on Git
3. Enter SSH url of your repository as repo url. you can get SSH url by going into bitbucket.
4. Under credentials, Click on Add, Jenkins.
5. Choose SSH username with private key
6. Enter username as ubuntu for Ubuntu. otherwise enter correct username.
7. check the enter directly under private key option
8. 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.
9. now choose the username(ubuntu) from the drop down.
10. run the build in Jenkins. Make sure there is no error.
That's it. This is how you use SSH url and private keys to checkout code from bitbucket or Github without entering username/password in Jenkins.
1. Go Jenkins. Click on your freestyle job, click on configure
2. Go to source code management, click on Git
3. Enter SSH url of your repository as repo url. you can get SSH url by going into bitbucket.
4. Under credentials, Click on Add, Jenkins.
5. Choose SSH username with private key
6. Enter username as ubuntu for Ubuntu. otherwise enter correct username.
7. check the enter directly under private key option
8. 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.
9. now choose the username(ubuntu) from the drop down.
10. run the build in Jenkins. Make sure there is no error.
That's it. This is how you use SSH url and private keys to checkout code from bitbucket or Github without entering username/password in Jenkins.
No comments:
Post a Comment