我有2台虚拟机(均为Ubuntu 12),SRV-ATLASSIAN(安装了Stash)和SRV-CI(安装了Jenkins)。
我想使用Jenkins的Git插件,所以我安装了它,在SRV-ATLASSIAN上创建了一个SSH密钥并将私钥(id_rsa)复制到/var/lib/jenkins/.ssh
我ssh-添加密钥
当我输入
时sudo su jenkins
cd /var/lib/jenkins/.ssh
git clone ssh://git@10.10.10.21:7999/test/test.git
在shell上,它确实可以正常工作。
当我将此URI输入jenkins的GIT插件时,我收到以下错误消息:
Using strategy: Default
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Command "git fetch -t origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我当然用Google搜索了这个问题,但我不明白为了让它发挥作用到底要做什么。奇怪的是我可以从shell中克隆用户“JENKINS”,但Jenkins本身不能..
答案 0 :(得分:0)
您需要授予Jenkins用户访问Stash存储库的权限。在Stash中创建用户,并将Jenkins用户的SSH公钥添加到Stash用户。然后为Stash项目或单个存储库设置权限,以便Jenkins用户可以访问您需要的存储库。有关详细信息,请参阅the Stash docs。