Ale*_*lla 2 git ssh git-submodules bitbucket-pipelines
如何在Bitbucket管道中使用git子模块?
我正在使用Bitbucket管道来构建我的项目,并且在子模块中遇到问题,我可能没有正确配置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
Run Code Online (Sandbox Code Playgroud)
我的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
Run Code Online (Sandbox Code Playgroud)
MyProject/.gitmodules带有子模块路径的文件:[submodule "modules"]
path = modules
url = git@bitbucket.org:....git
[submodule "translations"]
path = translations
url = git@bitbucket.org:....git
Run Code Online (Sandbox Code Playgroud)
2.
现在您需要将 ssh 密钥添加到子模块存储库
这是另一个例子
image: atlassian/default-image:2
pipelines:
default:
- step:
deployment: production
script:
- git submodule update --recursive --init
- apt-get update && apt-get install -y zip
- zip -r Test.zip . -x bitbucket-pipelines.yml *.git*
- pipe: atlassian/bitbucket-upload-file:0.1.3
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: Test.zip
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1295 次 |
| 最近记录: |