在Bitbucket管道中使用git子模块更新--init

时间:2019-09-27 21:10:44

标签: git git-submodules bitbucket-pipelines

我搜索了许多其他相关帖子,但没有找到解决方案。我有自己的私人laradock存储库,正在将其用作git存储库中的子模块。我有以下bitbucket-pipeline.yml文件:

pipelines:
  branches:
    master:
      - step:
          services:
            - docker
          caches:
            - docker
            - pip
            - composer
          name: Install server libs. Download and install composer. Build image, push to aws ecr, then deploy
          script:
            ...
            - git submodule update --init --recursive
            ...

运行管道时,出现以下错误:

+ git submodule update --init --recursive
Submodule 'laradock' (https://xxxx@bitbucket.org/xxxx/laradock.git) registered for path 'laradock'
Cloning into '/opt/atlassian/pipelines/agent/build/laradock'...
fatal: could not read Password for 'https://xxxx@bitbucket.org': No such device or address
fatal: clone of 'https://xxxx@bitbucket.org/xxxx/laradock.git' into submodule path '/opt/atlassian/pipelines/agent/build/laradock' failed

我尝试将ssh密钥添加到访问密钥。一直工作到今天早上。任何帮助都会很棒。

2 个答案:

答案 0 :(得分:1)

如果它需要HTTPS URL的密码,则意味着它是一个私有存储库,需要凭据。

如果您有权访问父存储库(包括laradock子模块),则可能需要编辑.gitmodules并使用SSH URL,如果您是using SSH in your Bitbucket pipeline

注意:BitBucket端有一个incident in progress,可以解释为什么现在任何HTTPS克隆都会失败

BitBucket pipeline

答案 1 :(得分:0)

我以自己不喜欢的方式修复了此问题,但目前为止可以使用。我必须在访问管理部分的bitbucket帐户中创建一个应用密码。然后,我将.gitmodules中的url更改为包括我的用户名和应用密码。这真的很烂,因为我的用户名和应用密码现在位于管道日志中。当然,我可以随时撤消该密码。我不想走这条路,但是我什么都做不了。任何人都可以找到更好的解决方案,例如repo vars中的IE用户名和密码。

相关问题