Open In App

How to Add GIT Credentials in Jenkins?

Last Updated : 17 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Git is a famous distributed version control system. Version Control Systems are mainly two types. Distributed & Centralised Version Control System. Centralized Version Control Systems are older & very hectic to use. That is why Distributed Version Control Systems are nowadays very famous for use. Besides Git, Mercurial and Bazaar are very well-known applications under Distributed Version Control systems. Git helps to modify any application with the help of other peers as well. That is why Git is being used on a large scale in companies. Also, Git can be installed in any third-party software as a plugin there. But Git is a repository. Only the GitHub repository can be installed into any third-party software.

Jenkins is an important open-source software. While developing any software for any client, it is important to test the software there. Jenkins helps a lot to test, and deploy software. It also helps to provide a demo run of the software. Products developed using Git can also be tested using Jenkins. For setup Git in Jenkins Credential is important. For that one important pre-requisite is to have Jenkins on the machine beforehand. Features of git:

  • Git helps to contribute to a single project by several contributions without changing the base structure of the project.
  • Git helps to branch a project development into several subtopics. Then they merge themselves & do a complete project.
  • Git helps to view the earlier changes made to a certain project.

Configuring Jenkins Credentials For Git

Step 1: At first, we need to open the Jenkins Dashboard on the machine. There on the left-hand side of the screen, we will find a couple of options provided there. First, we need to add a Credential option there. For that purpose, we need to click on the Manage Jenkins option.

Clicking-manage-jenkins-option

 

Step 2: Then, a new tab will open. There we need to click on the Manage Plugin option to add the Credential option there.

Clicking-manage-plugins-options

 

Step 3: Then we need to click on the Available Tab & we should search for ‘Credential’ in the search bar provided there.

Clicking-on-available-tab

 

Step 4: Then, we will find the Credential Plugin option available there. We need to click on it to install the Credential into Jenkins.

Installing-credentials-plugin

 

Step 5: Now, again, we move to the Jenkins Dashboard. There in those options menu, we will find the Credential option available. We need to click on it for further procedures.

Clicking-on-credentials

 

Step 6: There, a new tab will be opened. A Store Scoped tab will be available there. We have to click on Jenkins to add Git.

Adding-git

 

Step 7: Then again, we need to click on the Global Credential. It will open another window in front of the user.

Clicking-global-credentials

 

Step 8: In the newly opened window, on the very left-hand side of the screen, two options will be available. In between them, we need to click on Add Credential option to add Git Credentials into Jenkins.

Clicking-add-credentials

 

Step 9: Then, a new window will open. There is a couple of things we need to be aware of. There are many fields which we need to fill up.

  • There is a ‘Kind’ field option. This option is generally used for security purposes. The kind of security which is preferred by the user. That we need to enter there, there are a lot of options provided there. Any option can be chosen by the user.

Note: User please kindly note that, it is advisable to go for Username with password security only. Choosing any different kind of security option can arise problems in future. Though there will no such problems related to the machine for choosing any different kind of security. User may can’t remember the security aspects in future. In such cases, there will be problem while using Git.

  • There is a ‘Scope’ field. This field helps to determine the scope of Jenkins while operating Git. There are two options. Global & Private. Private means it can be only accessible from a certain machine only. Global means this can be accessible from every machine, as per user choice. They can choose any option.

Note: User please note that, it is advisable to choose the Global option. As it helps to do any job with the Git using Jenkins. If Private mode is being choose, then problem may arised when working with Got. Choosing Global option will not create0 any problem with Jenkins or with Git.

  • Then there are two fields available there. These are ‘Username’ & ‘Password’. Here, the user needs to provide the Username & the Password of their GitHub account. Providing any other Username & Password will not work here.
  • There is another field called ‘ID’. Please don’t provide any information there. It will be auto-filled by Jenkins while adding Git there.
  • Also, there is a ‘Description’ field. Users can provide any information there as per the user’s choice they can provide any information.

Then we have to click on the Ok option. Then the GitHub repository will be added to Jenkins. Users need to wait for the completion of the process.

GitHub-repository-added

 

Step 10: After successfully adding Git to Jenkins, the User can find the GitHub details on the Global Credentials page. This page will open automatically.

Global-credentials-page

 

Step 11: Now, we have completed the Jenkins Credential Setup for Git. We can also click on the details above. After clicking, we will find all the details there. Then we also noticed that the ‘ID’ section is filled up. If the ‘ID’ section is filled up automatically, then we have successfully added Git into Jenkins.

ID-section-filled

 

Hence, we have successfully set up Jenkins Credentials for Git.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads