Git is one of the famous distributed version control systems. There are mainly two types of version control systems. That is Distributed & Centralised Version Control System.
Nowadays Distributed Version Control Systems are commonly used Because Centralized Version Control Systems are older & very hectic to use. Git helps to modify any application with the help of other peers as well. So that Git is being used on a large scale in companies. Git is a repository as well as it can be installed in any third-party software. Jenkins is one of the important open-source software. In the software field, when developing software for a client,it helps in the test. Let’s check how we can add Git credentials in Jenkins
Create New Jenkins Job
Select a new item and create a new job there.
Specify the URL of the repository which we need to connect with jenkins.
Here add the URL of your remote repository. The following are some possible syntaxes for the repository URL:
* ssh://git@github.com/github/git.git
* git@github.com:github/git.git
* ssh://user@other.host.com/~/repos/R.git
* https://github.com/github/git.git
* git://github.com/github/git.git
Setup the build trigger
Then we can mention which operation should perform after our commit in the corresponding repository/branch
In some cases for example if you select pipeline to copy the HTTPS in name and change the definition pipeline from pipeline script to pipeline script from SCM. SCM was selected as Git.
Enter the GitHub repository here. After that there may be an error occurs on the screen.
In this case, we need to create an authentication with the GitHub repository, that is we need to set up a personal access token.
For this case go to github->settings ->Developer Settings ->Personal access tokens ->Create new token
Note means the name. Give a suitable name accordingly. After that set the expiration date and generate a token. Copy the token and go back to Jenkins.
Copy the token in the password column, add the name in the ID column and add. So the created credentials appear there. Select the created credential.
Specify the repository and save it.
Go to Build now -> Console output
Here view all modifications of GitHub. If go to build history see all history blocks.
The Console Output gives the output from execution. It contains a complete text log of output including status, In the earlier graphical Console Output log, is illustrated, But Jenkins features a plain text option. So it can be helped to find out special characters which are included in the output. If you view it as a plain text output, just click on the View as a plain text link.