鍍金池/ 問答/Java/ jenkins 連接github時(shí),總是提示Permission denied

jenkins 連接github時(shí),總是提示Permission denied (publickey)

1、jenkins創(chuàng)建job 連接github時(shí), git的選項(xiàng),添加repository url后,總是出現(xiàn)
‘ Command "git ls-remote -h git@github.com:.git HEAD" returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.
.’

以上錯(cuò)誤,(Credentials中輸入了正確的用戶名和密碼)

2、在本地終端執(zhí)行:git ls-remote -h git@github.com:.git
執(zhí)行成功。

3、已經(jīng)將本地連接github的.ssh文件拷貝到.jenkins/下

都沒能成功連接上github,真心求教,望不吝指教!

回答
編輯回答
敢試

主要看下本地終端執(zhí)行g(shù)it命令的用戶和jenkins啟動(dòng)用戶是不是相同。

jenkins的啟動(dòng)的默認(rèn)用戶是jenkins用戶,可以在jenkins的配置文件修改。

2017年2月9日 19:01