1
votes

I have followed below link and created Secret Text by getting my Token from Github repository. How should I use this Token credentials while I try to connect to Github repo under Jobs?

My main task is when I select Source Code Management as Git, I should not able to view credentials in my Job

https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin

enter image description here

enter image description here

1

1 Answers

0
votes

First, make sure you don't have 2FA activated, or the Auto-creating token would not work. Make sure you create your PAT (Personnal Access Token) directly on GitHub.

Add a new credential:

http://cdn2.hubspot.net/hubfs/208250/Blog_Images/Github_blog3.png?t=1475055065536

And make sure also the "Verify Credentials" button returns a valid test:

https://wiki.jenkins-ci.org/download/attachments/37749162/secret-text.png

Then:

Once that configuration is done, go to the project config of each job you want triggered automatically and simply check "Build when a change is pushed to GitHub" under "Build Triggers". With this, every new push to the repository automatically triggers a new build.

Note that there's only one URL and it receives all post-receive POSTs for all your repositories. The server side of this URL is smart enough to figure out which projects need to be triggered, based on the submission.

The url is not just under in "Git", but also GitHub:

http://cdn2.hubspot.net/hubfs/208250/Blog_Images/Github_blog5.png?t=1475055089580

See "How to Start Working with the GitHub Plugin for Jenkins" from Guy Salton.