代码之家  ›  专栏  ›  技术社区  ›  Nico Haase

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

  •  0
  • Nico Haase  · 技术社区  · 7 年前

    [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
    

    我不知道为什么会这样,我已经试过其他步骤了:

    • plugin-A
    • 我把子模块的URL从相对的修改为绝对的(在URL中给出 git submodule 正确确定)
    • git config http.https://bitbucket.org.proxy http://localhost:29418/

    我的设置有明显的错误吗?我还能试着让它工作吗?

    0 回复  |  直到 7 年前
        1
  •  0
  •   Nico Haase    7 年前

    好吧,我没想到我的错误这么明显,但我的同事们很快就帮了忙:

    • git checkout 使用存储库的HTTP url,而不是使用SSH
    • 因此,引用的子模块也使用HTTP url签出
    • 显然,这失败了,因为这是一个不允许匿名访问的私有存储库

    解决方案:使用SSH通过 git@bitbucket.org:$team/plugin-A.git