Team City Git“主机密钥验证失败"; [英] Team City Git "Host key verification failed"

查看:124
本文介绍了Team City Git“主机密钥验证失败";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用TeamCity从远程Git存储库提取代码,更新文件(并暂存并提交到本地存储库),然后将提交的文件推回远程存储库.

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.

拉力&更新很好.如果我打开git-bash和git push origin master,则提交(从更新的文件提交到本地仓库开始)将被推送到远程仓库.好吧.

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. Fine.

如果我尝试使用Team City的命令行运行程序执行此操作(到同一远程目标存储库),则失败

If I try to do this (to the same remote target repo) using a Team City's Command Line runner it fails with

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

目标存储库正在使用Gerrit进行身份验证.我已将公共密钥上载到Gerrit,并且已确认Gerrit的服务器主机密钥在C:\Users\AccountName\.ssh\known_hosts中.该文件夹还包含公钥和私钥.

The target repo is using Gerrit for authentication. 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. That folder also contains the public and private key.

我可以使用git-bash进行推送的事实告诉我密钥在正确的位置,但令我感到困惑的是,为什么Team City Command Line运行者不使用它们.

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.

作为参考,构建步骤的命令参数为-c "git push origin master".

For ref the build step's Command Parameters are -c "git push origin master".

任何人都可以看到我所缺少的吗?

Can anyone see what I am missing?

谢谢

推荐答案

您必须将TeamCity服务设置为可以访问您的密钥的同一帐户运行.默认情况下,TeamCity使用系统"帐户,这就是为什么不使用您的密钥的原因.

You have to set TeamCity service to run as the same account that has access to your keys. By default TeamCity uses the "System" account so that's why your keys are not being used.

这篇关于Team City Git“主机密钥验证失败";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆