How to store a Github Token safely in Jenkins Credentials
Goto Jenkins dashboard, click on Manage Jenkins
Click on Credentials
Click on System
Click on Global credentials
Click on Add Credentials
Under kind choose Username with password
With kind (Username with password ) you can store any credentials which have a username and password/token E.g. Github, DockerHub, Sonarqube, Jfrog Artifactory credentials
Select Scope as Global
Globally scoped credentials are accessible to any pipelines inside any folder in Jenkins
Enter the Username, and GitHub token in the Password section
Enter github-credential under ID and Github Credential under Description
Click on Create
Credential is created and the GitHub token is safely stored for use in Jenkins pipelines