Checkout of Git repository with submodules failed in Bamboo

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

要約

Checkout for repositories with submodules fails.

診断

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

原因

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.

ソリューション

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 

回避策

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.

オプション 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 

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

    ie.

    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

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

最終更新日 2022 年 9 月 22 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.