configurationJenkins使用GIT在Windows上,得到stderr:Permission denied(publickey)

我的Git版本是1.8.0,对于这个版本,Jenkins的Git安装path是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中。 然后我开始build立。 当我build立它时,我得到了:

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可以find我的密钥仓库URL,但无法find我的密钥,当它克隆存储库。

任何帮助将不胜感激。

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