简体   繁体   English

Team City Git“主机密钥验证失败”

[英]Team City Git “Host key verification failed”

I want to use TeamCity to pull code from a remote Git repo, update a file (and stage and commit to the local repo) and then push the committed file back to the remote repo. 我想使用TeamCity从远程Git仓库中提取代码,更新文件(并暂存并提交到本地仓库),然后将提交的文件推送回远程仓库。

The pull & update is fine. 拉动和更新很好。 If I open git-bash and git push origin master then the commit (arising from the updated file being committed to the local repo) is pushed to the remote repo. 如果我打开git-bash和git push origin master则提交(由更新的文件提交到本地存储库)将被推送到远程仓库。 Fine. 精细。

If I try to do this (to the same remote target repo) using a Team City's Command Line runner it fails with 如果我尝试使用Team City的命令行运行程序执行此操作(使用相同的远程目标存储库),则会失败

    [14:49:18][Step 3/7] Host key verification failed.
    [14:49:18][Step 3/7] fatal: Could not read from remote repository.

The target repo is using Gerrit for authentication. 目标repo使用Gerrit进行身份验证。 I have uploaded the public key to Gerrit and I have confirmed that the Server Host Key from Gerrit is in C:\\Users\\AccountName\\.ssh\\known_hosts . 我已将公钥上传到Gerrit,并且我已确认Gerrit的服务器主机密钥位于C:\\Users\\AccountName\\.ssh\\known_hosts That folder also contains the public and private key. 该文件夹还包含公钥和私钥。

The fact that I can push using git-bash says to me that the keys are in the correct places, but I am puzzled as to why the Team City Command Line runner is not using them. 我可以使用git-bash推送的事实告诉我,键位于正确的位置,但我很困惑为什么Team City Command Line的运行器没有使用它们。

For ref the build step's Command Parameters are -c "git push origin master" . 对于ref,构建步骤的命令参数是-c "git push origin master"

Can anyone see what I am missing? 谁能看到我失踪的东西?

Thanks 谢谢

You have to set TeamCity service to run as the same account that has access to your keys. 您必须将TeamCity服务设置为可以访问您的密钥的同一帐户。 By default TeamCity uses the "System" account so that's why your keys are not being used. 默认情况下,TeamCity使用“系统”帐户,这就是您的密钥未被使用的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM