Jenkins configuration with git via SSH


Add SSH certificate to Jenkins to pull repository from git server (example gitlab)

Prerequisite :
a) git must be installed on user’s computer
b) jenkins must be running on user’s computer

To achieve this we need to follow the steps –
1.Open Git bash and type “ssh-keygen -t rsa -C ‘tanmay’

2.Now a “.ssh” folder will be created at your “username” folder with the 2 following files –

3.Open “” in note pad and copy the content and paste it on your gitlab profile [or your preferred git server example – github/bitbucket/stash/visualstudio]
4.Now in bash type “ssh -T” pres enter. Confirm the connection by typing “yes”
5. Provide the pass phrase and if it is correct the we will get a Welcome message like below screen – .

Note : in some case you may get the followin message additionally

Hi <username>! You've successfully authenticated, but <git-server> does not provide shell access.

But ignore this message.
6. Now create a new project in jenkins and go to project configuration page and select “git” as Source Code Management.

7. Click “Add” button beside credential button and select “Kind” option as “SSH Username with private key”

8. Provide all the information and save it like –

9. Now paste the SSH git repository link and select your password from drop down menu.

10. Now click on save button and run your first build.
11. Your POM file will do rest of the work and finally you will get the following similar output at your console –

Thank you!

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *