Why does Jenkins get an authentication error when updating the git submodule?

I have a Jenkins job that pulls from a repo that works great and still has it. However, I added a submodule, and Jenkins is choking on it. Here is the clip from the Jenkins console output:

FATAL: command "C: \ Program Files (x86) \ Git \ cmd \ git.exe update submodule" returned status code 1: stdout: Cloning to 'subodules / my.repo' ...

stderr: fatal: Authentication failed

I am using the ssh key, which I added to my deployment keys for the main repo in BitBucket. And it always worked. I added the same key to my submodule repository deployment keys. Can someone tell me why authentication is not working?

+7
source share
4 answers

Versions of the Jenkins git plugin prior to 3.0.0 did not support sub-module authentication. Submodule validation using the same credentials and protocol as the parent repository is now supported by the Jenkins git plugin. Support was added in the release of Jenkins git version 3.0.0 dated September 10, 2016.

Part of the submodule configuration on the job definition page (Advanced> Behavior of Additional Submodules) now includes the checkbox “Use credentials from the remote database of the parent repository.” Select the check box and the credentials from the parent repository will be used for the submodules.

Note that the repository cloning protocols must be the same (ssh or https) for the parent repository and submodules, otherwise the parent credentials cannot be used with the submodule repository.

+1
source

Try copying the /.shh folder to your Jenkins home directory.

0
source

I ran into this problem with Jenkins Slave (executed as a windows service). I solved this by expanding the Jenkins SSH key in the .ssh directory of SYSTEM user:

 C:\Windows\SysWOW64\config\systemprofile\.ssh\ 

The SYSTEM home directory differs depending on the OS version and configuration. To identify this, simply an echo of env. var. %USERPROFILE%

0
source
0
source

All Articles