Checkout of Git repository with submodules failed in Bamboo

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Checkout for repositories with submodules fails.

Diagnosis

The following appears in the atlassian-bamboo.log:

1 2 3 4 '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 older versions. In particular, Bamboo doesn't provide credentials for submodule operations and the credentials must be available to Git via the environment on the agent.

Solution

Submodules accessed via SSH

Upgrade to Bamboo 8.1.1 which provides submodule authentication support:

Enable the option at Repository Configuration >> Advanced Options >> SSH key applies to submodules

Workaround

Submodules accessed via SSH

Submodules accessed via HTTP/HTTPS

Windows

Option 1: Recommended

Use Git Credential Manager. Make sure GCM_INTERACTIVE is set to Never.

Option 2:

This workaround involves storing credentials in plaintext in a file and may not be suitable for all environments depending on security requirements.

  1. Create _netrc file

    1 2 3 machine <hostname> login <login> password <password>

    For example:

    1 2 3 machine bitbucket.org login kbrazulewicz password ******
  2. Copy _netrc to the home directory of account used by Bamboo

    1. C:\WINDOWS\system32\config\systemprofile for instances running as system service.

    2. user's home directory for instances run from console.

  3. Repeat the copy for all remote agents that are supposed to checkout this repository.

  4. If Bamboo is run as service (using Local System Account) you should make sure that HOME environment variable is set.

    1. Go to Administration / System information, scroll down to section Environment Variables and check if HOME variable is defined.

    2. If not, create a no-repository plan with a script task that would run

      1 setx HOME C:\WINDOWS\system32\config\systemprofile
    3. Run this plan on local agent.

    4. Run this plan on all remote agents that are supposed to checkout this repository.

    5. Reboot Bamboo server (it is not enough to restart service).

    6. Reboot all remote agents that are supposed to checkout this repository.

    7. 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 the repository and initialize submodules.

Updated on March 24, 2025

Still need help?

The Atlassian Community is here for you.