Bitbucket 管道不处理相对 git 子模块 url 以进行 ssh 检出?

Bitbucket pipeline does not handle relative git submodule url for ssh checkout?

我有一个 bitbucket 托管的 git 存储库,它有一个 git 子模块存储库。 我想在 .gitmodules 文件中使用亲戚 url,以允许使用 https 和 ssh:

[submodule "sm-ourlib"]
path = sm-ourlib
# url = git@bitbucket.org:companyname/ourlib.git
# Use relative url to allow for both HTTP and SSH access, see 
url = ../ourlib.git

但是,似乎 bitbucket 管道无法按预期处理相对 url,因为它没有将 ssh 用于相对 url 的子存储库,而是使用 https 并失败. (对于绝对 url,它正确使用了 ssh)。

管道 运行 在 git submodule update --init 步骤中失败:

+ git submodule update --init
Submodule 'sm-ourlib' (http://bitbucket.org/companyname/ourlib.git) registered for path 'sm-ourlib'
Cloning into '/opt/atlassian/pipelines/agent/build/sm-ourlib'...
fatal: could not read Username for 'https://bitbucket.org': No such device or address
fatal: clone of 'http://bitbucket.org/companyname/ourlib.git' into submodule path '/opt/atlassian/pipelines/agent/build/sm-ourlib' failed
Failed to clone 'sm-ourlib'. Retry scheduled
Cloning into '/opt/atlassian/pipelines/agent/build/sm-ourlib'...
fatal: could not read Username for 'https://bitbucket.org': No such device or address
fatal: clone of 'http://bitbucket.org/companyname/ourlib.git' into submodule path '/opt/atlassian/pipelines/agent/build/sm-ourlib' failed
Failed to clone 'sm-ourlib' a second time, aborting

这是一个已知问题,还是我做错了什么?

我遇到了同样的问题。 Bitbucket 在结帐期间使用 https,因此相对 URL 也使用 https 解析。通过以下 hack,可以修补构建管道以重写 .gitmodules 文件:

          script:
            - sed -i 's/url = \.\.\(.*\)/url = git@bitbucket.org:<your org>\.git/g' .gitmodules
            - git submodule update --init