How to use git submodules with Bitbucket pipelines?

老子叫甜甜 提交于 2019-12-08 02:39:51

问题


How to use git submodules with Bitbucket pipelines?

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.

What I've done:

  1. Created SSH key pair in my computer.
  2. Pasted the same key pair in both repositories (repo where the build will run and in the dependency repo) under Settings/SSH keys.

The build error:

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

My yml file

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

回答1:


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



来源:https://stackoverflow.com/questions/53121955/how-to-use-git-submodules-with-bitbucket-pipelines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!