如何在Bitbucket管道中使用git子模块? [英] How to use git submodules with Bitbucket pipelines?

查看:89
本文介绍了如何在Bitbucket管道中使用git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Bitbucket管道中使用git子模块?

How to use git submodules with Bitbucket pipelines?

我正在使用Bitbucket管道来构建我的项目,并且在拉入子模块时遇到问题,我可能无法正确配置SSH密钥.

I'm using Bitbucket pipelines to build my project and I'm having issues pulling in my submodule, I'm probably not configuring the SSH keys correctly.

我所做的:

  1. 在我的计算机中创建了SSH密钥对.
  2. 在设置/SSH密钥"下的两个存储库(将在其中运行构建的存储库和依赖项存储库)中粘贴了相同的密钥对.

构建错误:

Submodule 'dependencies/my-dependency' (git@bitbucket.org:mycompany/my-dependency.git) registered for path 'dependencies/my-dependency'
Cloning into 'dependencies/my-dependency'...
Warning: Permanently added the RSA host key for IP address '18.205.93.2' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Clone of 'git@bitbucket.org:mycompany/my-dependency.git' into submodule path 'dependencies/my-dependency' failed

我的yml文件

image:
  name: myuser/my-image-name
  username: $DOCKER_HUB_USERNAME
  password: $DOCKER_HUB_PASSWORD
  email: $DOCKER_HUB_EMAIL

pipelines:
  branches:
    pipelines-setup:
      - step:
          script:
            - git submodule update --init

推荐答案

找到了解决方案.我必须将ssh公钥添加到Settings / Access Keys 不是 Settings / SSH Keys下的子模块存储库中.

Found the solution. I had to add the ssh public key to the submodule repository under Settings / Access Keys not Settings / SSH Keys.

这篇关于如何在Bitbucket管道中使用git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆