我们将 git 视为一些配置和 csv 文件的数据库。我有一个 Bamboo 计划,我在其中 checkout 一些代码(来自 Stash),运行节点脚本并生成一些 csv 文件。 我需要能够将它们“git Push”到某个存储库。 我有一个脚本任务,我正在写这样的东西 -
git remote add central ssh://git@stashRepoUrl:port/xyz.git
git config --global user.name "Bamboo"
git config --global user.email "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="385a59555a575778404142165b5755" rel="noreferrer noopener nofollow">[email protected]</a>"
git add src/main/resources/lookups/main/common/*
git add src/main/resources/lookups/main/reference/*
git commit -m "FROM BAMBOO JOB"
git push -u central featureBranchName
我收到以下错误 - 主机 key 验证失败。
如何在我的存储库和这个“bamboo agent”之间设置 ssh?我确信有人可能已经尝试过这个。
谢谢!
最佳答案
您需要使用脚本使用的帐户手动执行(仅一次):
ssh -T git@stashRepoUrl -p port
这将触发一个问题,您回答"is"(更新 ~/.ssh/known_hosts
)
然后您的脚本就可以继续进行。
请注意,我还会手动设置该行:
git remote add central ssh://git@stashRepoUrl:port/xyz.git
您只需使用该命令一次,而不是每次运行脚本时使用。
关于git - 如何从 Bamboo Script 任务中执行 git Push,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43082160/