在私有存储库中使用Bitbucket管道和git子模块

问题描述 投票:-3回答:1

我们尝试为包含git子模块的私有项目实现Bitbucket管道。它们在我们的项目中引用如下:

[submodule "plugins-custom/plugin-A"]
    path = plugins-custom/plugin-A
    url = ../plugin-A.git

此存储库存在,可以使用git submodule update --init在本地安全地检出。

使用Bitbucket管道运行相同的命令时,会在日志中打印以下行:

+ git submodule update --init
Submodule 'plugins-custom/plugin-A' (http://bitbucket.org/$team/plugin-A.git) registered for path 'plugins-custom/plugin-A'
Cloning into 'plugins-custom/plugin-A'...
fatal: could not read Username for 'https://bitbucket.org': No such device or address
Clone of 'http://bitbucket.org/$team/plugin-A' into submodule path 'plugins-custom/plugin-A' failed

我不知道为什么会发生这种情况,这些是我已经尝试过的其他步骤:

  • 在包含并触发子模块的项目中生成了一个SSH密钥,该密钥被添加到引用的plugin-A存储库中
  • 我想把子模块的URL从那个相对的URL更改为绝对的一个(在git submodule正确确定的URL中给出的lke)
  • 我尝试添加代理设置,因为管道在代理设置过程中已经做了(比如git config http.https://bitbucket.org.proxy http://localhost:29418/

我的设置有任何明显的错误吗?我还能尝试使其工作吗?

git bitbucket git-submodules bitbucket-pipelines
1个回答
0
投票

好吧,我没想到我的错误是如此明显,但我的同事能够迅速提供帮助:

  • 管道使用HTTP URL到我们的存储库执行git checkout,而不使用SSH
  • 因此,使用HTTP URL也检查了引用的子模块
  • 显然,失败了,因为这是一个不允许匿名访问的私有存储库

解决方案:使用SSH通过[email protected]:$team/plugin-A.git执行子模块的检出

© www.soinside.com 2019 - 2024. All rights reserved.