无法让TeamCity使用默认私钥对GitHub进行身份验证 [英] Cannot get TeamCity to authenticate to GitHub with Default Private Key

查看:659
本文介绍了无法让TeamCity使用默认私钥对GitHub进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让TeamCity构建我的私人GitHub存储库。当我明确设置密钥文件的路径时,我能够成功地让我的VCS根通过连接测试;然而,尽管有很多谷歌搜索,当我使用默认私钥选项时,我无法使其工作。我得到 com.jcraft.jsch.JSchException:认证失败



我的TeamCity服务器和构建代理都在运行( gasp teamcity ,以及 C:\ users \teamcity\的内容。 ssh \ 包含一个 config 和一个密钥文件,其中配置指向密钥文件。我的配置包含:

 主机* 
IdentityFile〜/ .ssh / github.key

我试过了各种不同的路径样式,包括Windows和Unix样式,但没有一个可以工作。 b
$ b

同样,如果我使用私钥设置并显式设置密钥文件的路径,但在使用时不起作用默认私钥,这显然需要我的构建代理才能使用。

解决方案 $ b $ ol
上传你的(OpenSSH)键到你的Pipeline项目设置下的SSH密钥(如下所示):





< blockquote>

查看OpenSSH信息的资源链接(为什么/如何) b $ b

>

然后在VCS根设置中,更新认证设置,如下所示: pngrel =nofollow noreferrer>



  • 记事:用户名是; git (请参阅​​第3个资源)

确保你的Fetch URL看起来像git@bitbucket.org:ProjectName / RepositoryName.git - ( Note :这里需要Github等效)

  • 添加您的新密钥(请参阅第1个资源)

  • strong>


    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:

    1. Upload your (OpenSSH) key under your Pipeline's project settings "SSH Keys" (as seen below):

      Look at resource links for OpenSSH info (why/how)

    2. And then in VCS root settings, Update "Authentication Settings" as seen below:

      • note: the username is; "git" (see 3rd resource)

    3. Make sure your "Fetch URL" look something like "git@bitbucket.org:ProjectName/RepositoryName.git" - (Note: Github equivalent is required here)

    4. Add your new key (see 1st resource)

    Resources:

    这篇关于无法让TeamCity使用默认私钥对GitHub进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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