配置Jenkins在Windows上使用GIT,得到stderr:权限被拒绝(publickey)

时间:2013-01-20 20:18:37

标签: windows git jenkins

我的Git版本是1.8.0,对于这个版本,Jenkins中的Git安装路径是C:\ Git \ cmd \ git.exe(在旧版本中,它是C:\ Git \ cmd \ git.cmd) 。这解决了我遇到的问题:删除工作区时出错。在Jenkins中,Git存储库URL使用ssh协议:git@github.com:xxxxx / xxx.git,对我来说,此URL有效。如果找不到您的密钥,此URL将返回错误,您需要定义%HOME%,然后您的密钥应该在%HOME%.ssh中。然后我开始建立。当我建造它时,我得到了:

 stdout: Cloning into 'C:\Jenkins\workspace\Lily'...

 stderr: Permission denied (publickey).
 fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)

我不明白为什么Jenkins可以找到我的存储库URL密钥,但是在克隆存储库时无法找到我的密钥。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

我的公司有一个代理服务器,对我来说,使用SSH协议非常困难,它可能有办法解决代理服务器和ssh-to-github的组合,但我放弃了。相反,我使用了https协议。为了不提示Jenkins的凭据,我使用github凭证缓存来解决这个问题。在此处查看凭据缓存:http://www.kernel.org/pub/software/scm/git/docs/git-credential-cache.html。现在我的Jenkins / Git构建在Windows中运行。

相关问题