Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins does not show configured git credentials

I have Jenkins 2.204.2 and want to configure a project with my git credentials for our gitlab server.

I created under Jenkins > Credentials > System > Global credentials an entry with a secret key.

Nevertheless, if I create a freestyle project and set git as source code management, the opttions for Credentials remain empty.

Also if I use the Add button next to the credentials options and add the same secret key again, this does not show up in the options (though the new entry is shown in the Global credentials menu).

How can I configure the credentials to be used for Jenkins ? What do I miss, that I cannot select my created credentials ?

like image 973
Emerson Cod Avatar asked Feb 12 '20 08:02

Emerson Cod


1 Answers

To use the git protocol (and not the https protocol) your Jenkins credentials must be of type "SSH Username with private key".

Even so, those credentials won't appear in the dropdown list due to this known issue: likely you have installed the "Authorize Project" Plugin and in the "Configure Global Security" > "Project Default Build Authorization" section, "Strategy" field configured to "Run as specified user" (and a user) or "Run as anonymous". As a workaround for the issue, you can select "Run as SYSTEM" and the SSH credentials will appear in the list.

See:

Why credentials are not listed in the GIT SCM section? https://support.cloudbees.com/hc/en-us/articles/360017499672-Why-credentials-are-not-listed-in-the-GIT-SCM-section-

like image 71
Carlos Quintero Avatar answered Nov 15 '22 14:11

Carlos Quintero