bitbucket - 使用公钥的 Bitbucket Pipeline git fetch 失败
问题描述
在下面文章的帮助下,我为 bitbucket 设置了 SSH 密钥,因此我可以在管道中使用它 https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/
通过输入以下命令在终端窗口上进行测试时,它可以正常工作:
$ ssh -T git@bitbucket.org
在我的 bitbucket 配置文件My Pipeline下添加了公钥 :
image:
name: abhisheksaxena7/salesforcedockerimg
pipelines:
branches:
feature/**:
- step:
script:
- ant -buildfile build/build.xml deployEmptyCheckOnly -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL
# master:
# - step:
# script:
# - ant -buildfile build/build.xml deployCode -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL
Admin-Changes:
- step:
script:
- echo my_known_hosts
# Set up SSH key; follow instructions at https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Bitbucket+Pipelines
- (mkdir -p ~/.ssh ; cat my_known_hosts >> ~/.ssh/known_hosts; umask 077 ; echo $SSH_KEY | base64 --decode -i > ~/.ssh/id_rsa)
# Read update_to_trigger_pipelines.txt into commitmsg variable
- commitmsg="$(<update_to_trigger_pipelines.txt)"
# Set up repo and checkout master
- echo git@bitbucket.org:$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG.git
- git remote set-url origin git@bitbucket.org:$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG.git
- git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch
- git checkout master
# Get metadata from server
- ant -buildfile build/build.xml getCode -Dsfdc.username=$SFDC_USERNAME -Dsfdc.password=$SFDC_PASS$SFDC_TOKEN -Dsfdc.serverurl=https://$SFDC_SERVERURL
# Commit any changes to master
- git add force-app/main/default/*
- git config user.name "$GIT_USERNAME"
- git config user.email "$GIT_EMAIL"
- if [[ -n $(git status -s) ]] ; then filelist=`git status -s` ; git commit -a -m "$commitmsg" -m "$filelist" ; git push origin master:master ; else echo "No changes detected"; fi
解决方案
推荐阅读
- python-3.x - keras中的重复节点
- android - 执行 Volley 网络调用的 UnitTest 方法
- sql - 如何优化查询以使用oracle中另一个表中的列更新表列
- uno-platform - 我可以在 Web 程序集中使用 DataGrid 吗?
- .net - 通过 Octopus powershell 启动服务超时失败
- date - 历史上的今天 elasticsearch
- mysql - mysqldump 10.17 创建一个没有数据的转储文件,而 10.16 工作正常
- python - 在matplotlib python中打印x over y
- postgresql - 无法验证连接(此连接已关闭。)。可能考虑使用更短的 maxLifetime 值
- ruby-on-rails - Rails,部署到 Heroku 后:无法运行控制台,db:migrate