April 27, 2020
Estimated Post Reading Time ~

Integration of Jenkins server with GIT Hub

We are having multiple blogs around this but could not able to find the complete information on this.

Thought of sharing this for my reference too. This post will explain how to integrate Jenkins in Linux with private GIT Hub.

Configuring the GIT plugin in Jenkins:
Jenkins à Manage Jenkins à Manage Plugins

Make sure Jenkins GIT Client Plugin and Jenkins GIT plugins are installed.


Configure GIT in server:
Login to Jenkins server via puty
Execute the following command - sudo yum install git-all

Configure GIT executable path:
Jenkins àMange JenkinsàConfigure System
Enter the git executable path(git installed to the server in previous step)
My case the path is /usr/bin/git, change accordingly



SSH Configuration:
Login to Jenkins server via putty
Execute the following commad - sudo -u jenkins ssh-keygen -t rsa
Enter the details accordingly, Passphrase is optional if required then enter some string.
This will create private and public keys under /var/lib/jenkins/.ssh (default files are id_rsa and id_rsa.pub)

Configuring Credential:
Login to Jenkins console --> Jenkins --> Credentials

Click on add a domain – Enter some name(better git hub host name)
Click on Add credential
Enter the user name as Jenkins(the user that runs the Jenkins)
Select From the Jenkins master ~/.ssh



Configure deployment key in GIT:
Login to GIT and click on Profile Settings
Click on SSH Keys – Enter the content of id_rsa.pub(cat id_rsa.pub) to Key filed
Click on add key.





Configure the Job:
Configure the GIT URL and select the credential name created in the previous step
Specify the branch to be build.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.