【发布时间】:2016-02-28 08:04:17
【问题描述】:
我需要在 TeamCity 构建步骤中执行 git 命令。
这些 git 命令需要为 git repo 使用基于 SSH 的 url,以便作为 git 服务器的特权用户进行身份验证(因为这些 git 命令实际上会修改 git repo,而不仅仅是读取它)。
我知道this question。
我已经有 VCS 结帐模式“自动在代理上”。 VCS root 已正确配置 ssh 并且运行良好。
但是,作为stated in the documentation,TeamCity
将密钥临时保存在代理的文件系统中,并在 git fetch/clone 完成后将其删除。
因此,即使 TeamCity 在代理端结账期间正确使用了 SSH 密钥,该密钥在构建后期也有意无法访问。
但是我真的很想以后再使用密钥!
git 命令生成的输出是:
[06:12:29][Step 3/4] Permission denied (publickey).
[06:12:29][Step 3/4] fatal: Could not read from remote repository.
[06:12:29][Step 3/4]
[06:12:29][Step 3/4] Please make sure you have the correct access rights
[06:12:29][Step 3/4] and the repository exists.
我已确认known_hosts 文件存在并包含适当的公钥。我还确认C:\Users\systeamcityagent\.ssh 不包含任何私钥(如预期的那样)。
我正在运行 TeamCity Enterprise 9.1.3。
对此有什么推荐的解决方案?
【问题讨论】:
-
你让它工作了吗?我处于类似情况,我很难让 ssh 代理与我的 git push 一起工作。
标签: git ssh teamcity ssh-keys teamcity-9.0