【发布时间】:2018-04-14 11:26:37
【问题描述】:
我已经按照 Jay Proulx 在 https://medium.com/@jay_proulx/aws-codecommit-from-atlassian-bitbucket-and-bitbucket-pipelines-for-ci-offloading-4f1131695802 的说明设置了一个 Bitbucket 管道以推送到 CodeCommit
我已将 ssh 密钥(由 Windows 上的 puttygen 生成)上传到 AWS IAM,并在 Bitbucket Pipeline 变量中进行了如下配置。
bitbucket-pipelines.yml 看起来像:
pipelines:
default:
- step:
script:
- echo $CodeCommitKey > ~/.ssh/codecommit_rsa.tmp
- base64 -d ~/.ssh/codecommit_rsa.tmp > ~/.ssh/codecommit_rsa
- chmod 400 ~/.ssh/codecommit_rsa
- echo $CodeCommitConfig > ~/.ssh/config.tmp
- base64 -d ~/.ssh/config.tmp > ~/.ssh/config
- set +e
- ssh -o StrictHostKeyChecking=no $CodeCommitHost
- set -e
- git remote add codecommit ssh://$CodeCommitRepo
- git push codecommit $BITBUCKET_BRANCH
$CodeCommitConfig 是 base64 编码的版本:
Host git-codecommit.ap-southeast-2.amazonaws.com
HostName git-codecommit.ap-southeast-2.amazonaws.com
User APKAxxxx
IdentityFile ~/.ssh/codecommit_rsa
Bitbucket 管道中的环境变量:
$CodeCommitHost = git-codecommit.ap-southeast-2.amazonaws.com
$CodeCommitRepo = git-codecommit.ap-southeast-2.amazonaws.com/v1/repos/myrepo
$CodeCommitUser = APKAxxxx
$CodeCommitKey = [The base64 encoded version of the SSH private key]
在管道的最后一步,我收到错误:
+ git push codecommit $BITBUCKET_BRANCH
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在前面的步骤中遇到了类似的错误:
+ ssh -o StrictHostKeyChecking=no $CodeCommitHost
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added the RSA host key for IP address '103.8.175.33' to the list of known hosts.
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory
Permission denied (publickey).
我已经进行了几次设置并得到相同的结果 - 我做错了什么?
【问题讨论】:
-
我自己也遇到同样的错误,你解决了吗?
-
@edencorbin 是的,在下面回答:)
-
有趣,我在 linux 上使用 ssh-keygen 时遇到了这个确切的问题,atm 我只是直接使用 CodeDeploy,但我想解决这个问题
标签: git bitbucket bitbucket-pipelines aws-codecommit