无法让TeamCity使用默认私钥对GitHub进行身份验证 [英] Cannot get TeamCity to authenticate to GitHub with Default Private Key
问题描述
我试图让TeamCity构建我的私人GitHub存储库。当我明确设置密钥文件的路径时,我能够成功地让我的VCS根通过连接测试;然而,尽管有很多谷歌搜索,当我使用默认私钥选项时,我无法使其工作。我得到 com.jcraft.jsch.JSchException:认证失败
。
我的TeamCity服务器和构建代理都在运行( gasp ) teamcity
,以及 C:\ users \teamcity\的内容。 ssh \
包含一个 config
和一个密钥文件,其中配置指向密钥文件。我的配置包含:
主机*
IdentityFile〜/ .ssh / github.key
我试过了各种不同的路径样式,包括Windows和Unix样式,但没有一个可以工作。 b
$ b
同样,如果我使用私钥
设置并显式设置密钥文件的路径,但在使用时不起作用默认私钥
,这显然需要我的构建代理才能使用。
上传你的(OpenSSH)键到你的Pipeline项目设置下的SSH密钥(如下所示):
< blockquote>
查看OpenSSH信息的资源链接(为什么/如何) b $ b
>
然后在VCS根设置中,更新认证设置,如下所示: pngrel =nofollow noreferrer>
- 记事:用户名是; git (请参阅第3个资源)
确保你的Fetch URL看起来像git@bitbucket.org:ProjectName / RepositoryName.git - ( Note :这里需要Github等效)
添加您的新密钥(请参阅第1个资源)
- 这是一个帮助我找到解决方案的链接(请参阅Putty主题部分)
- https://confluence.jetbrains.com/display/TCD9/SSH+Keys+Managementrel =nofollow noreferrer>关于SSH密钥的TeamCity文档
- 用户名应该是git
I'm trying to get TeamCity to build my private GitHub repository. I'm able to successfully get my VCS root to pass the connection test when I explicitly set the path to the key file; however, despite lots of Googling, I can't get it to work when I use the 'Default Private Key' option. I get com.jcraft.jsch.JSchException: Auth fail
.
Both my TeamCity server and build agent are running as a user called (gasp) teamcity
, and the contents of C:\users\teamcity\.ssh\
include both a config
and a key file, where the config is pointing to the key file. My config contains:
Host *
IdentityFile ~/.ssh/github.key
I've tried a variety of different path styles, both Windows and Unix style, but none seem to work.
Again, it works fine if I use the private key
setting and explicitly set the path to the key file, but not when I use the default private key
, which I apparently need for my build agent to work.
Easiest solution for me was this:
Upload your (OpenSSH) key under your Pipeline's project settings "SSH Keys" (as seen below):
Look at resource links for OpenSSH info (why/how)
And then in VCS root settings, Update "Authentication Settings" as seen below:
- note: the username is; "git" (see 3rd resource)
Make sure your "Fetch URL" look something like "git@bitbucket.org:ProjectName/RepositoryName.git" - (Note: Github equivalent is required here)
Add your new key (see 1st resource)
Resources:
- Here's a link that helped me get to the solution (see section for Putty keygen)
- TeamCity Docs regarding SSH Keys
- Username should be "git"
这篇关于无法让TeamCity使用默认私钥对GitHub进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!