Why is Jenkins getting Authentication Failed error for git submodule update?

I have a Jenkins job that pulls from a BitBucket repo that was working fine, and still is. However, I’ve added a submodule and Jenkins is choking on that. Here is a clip from the Jenkins console output:

FATAL: Command “C:\Program Files (x86)\Git\cmd\git.exe submodule update” returned status code 1:
stdout: Cloning into ‘submodules/my.repo’…

  • How can I get write access for a deployment key on bitbucket or something like that?
  • Restore Merged Branch in Bitbucket Repo
  • Configuring egit with BitBucket
  • Jenkins git submodule update fails
  • Bitbucket git push ssh “conq: invalid repository syntax.”
  • How does my git repository keep getting corrupted?
  • stderr: fatal: Authentication failed

    I’m using an ssh key which I added to my deployment keys for the main repo in BitBucket. And that’s always worked. I added the same key to my submodule repo’s deployment keys. Can anyone tell me why authentication is failing?

  • Relational database backend for mercurial or git
  • Git, rewrite previous commit usernames and emails
  • Is it possible to call Git or other command line tools from inside a Thor script?
  • How can I restore a local branch after deleting it?
  • git merge conflict due to renaming in two branches - how to fix & avoid in future?
  • How to setup coloured git diff with vim as a pager
  • 4 Solutions collect form web for “Why is Jenkins getting Authentication Failed error for git submodule update?”

    Try to copy the /.shh folder into your Jenkins home directory.

    I faced this issue, with Jenkins Slave (executed as Windows Service).
    I solved it by deploying Jenkins SSH key in the .ssh directory of the SYSTEM user:


    SYSTEM home directory varies depending on OS version and setup. To identify it just echo env. var. %USERPROFILE%

    Versions of the Jenkins git plugin prior to 3.0.0 did not support submodule authentication. Submodule authentication using the same credentials and protocol as the parent repository are now supported with the Jenkins git plugin. Support was added in the 10 Sep 2016 release of Jenkins git plugin 3.0.0.

    The submodule configuration portion of the job definition page (“Additional Behaviours” > “Advanced Sub-modules Behaviours”) “now includes a checkbox “Use credentials from default remote of parent repository”. Check that 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 the submodules, otherwise the parent credentials can’t be used with the submodule repository.

    Git Baby is a git and github fan, let's start git clone.