我正在努力让我们的Ubuntu TeamCity服务器通过SSH签出存储库。基本上我的问题是,在哪里可以指定私钥密码?

在承载teamcity的计算机上运行Shell并以运行teamcity的用户身份登录时,我可以运行hg clone ssh://hg@localhost/test来克隆存储库“ test”。但是我必须输入用户的私钥密码。

我的TeamCity项目设置为:


从以下位置拉取更改:hg clone ssh:// hg @ localhost / test
密码:(私钥密码)


单击“测试连接”将导致

Test connection failed in Test :: Test 42. '/usr/bin/hg identify ssh://hg@localhost/test' command failed.
stdout: remote: Permission denied, please try again.
remote: Permission denied, please try again.
remote: Permission denied (publickey,password).

stderr: abort: no suitable response from remote hg!

最佳答案

如果密钥对仅用于TeamCity服务器与Mercurial存储库的交互,这是最简单且仍安全的解决方案,但前提是您要使用足够有限的访问权限来保护私钥文件(即,TeamCity服务器作为运行该用户的用户为只读) ),就是从私钥中删除密码。具有空密码短语的私钥将不再​​提示输入密码短语,因此不需要用户交互,从而实现了自动化解决方案。

关于linux - 在Linux上通过SSH进行TeamCity和Mercurial,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13072352/

10-13 09:35