Checkout of Git repository with submodules failed

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Checkout for repositories with submodules fails.

The following appears in the atlassian-bamboo.log:

'C:\Program Files (x86)\Git\bin\git.exe' submodule update --init --recursive
Cloning into '<submodule-path>'...
fatal: Authentication failed
Clone of '<repository-url>' into submodule path '<submodule-path>' failed

Cause

Bamboo support for submodules is limited. In particular Bamboo does not handle authentication for submodules and agent environment has to provide authentication

Resolution

Submodules accessed via SSH

  • configure passwordless SSH keys for the account used by Bamboo

Submodules accessed via HTTP/HTTPS

Windows

  • create _netrc file 

    machine <hostname>
    login <login>
    password <password>

    ie.

    machine bitbucket.org
    login kbrazulewicz
    password ******
  • copy _netrc to the home directory of account used by Bamboo
    • C:\WINDOWS\system32\config\systemprofile for instances running as system service
    • user's home directory for instances run from console
  • repeat the copy for all remote agents that are supposed to checkout this repository
  • if Bamboo is run as service (using Local System Account) you should make sure that HOME environment variable is set
    • go to Administration / System information, scroll down to section Environment Variables and check if HOME variable is defined
    • if not, create a no-repository plan with a script task that would run

      setx HOME C:\WINDOWS\system32\config\systemprofile
    • run this plan on local agent
    • run this plan on all remote agents that are supposed to checkout this repository
    • reboot Bamboo server (it is not enough to restart service)
    • reboot all remote agents that are supposed to checkout this repository
    • go to Administration / System information, scroll down to section Environment Variables and verify if HOME variable is defined

Now Bamboo should be able to successfully checkout repository and initialize submodules

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.