问题:jenkins在配置git时,在Source Code Management项目下添加git地址和选择账户后,提示
Failed to connect to repository : Command "git ls-remote -h -- git@github.com:qingtain1234/interfaceTest.git HEAD" returned status code 128:
stdout:
stderr: Load key "/tmp/jenkins-gitclient-ssh4445800001373071006.key": invalid format
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因:git地址填写错误或账号错误
解决办法:
1、填写正确的git地址
2、点击Add Credentials添加正确的账号
Kind选择SSH Username with private key
填写Description(目的是在账号过多的时候方面查找),username和私钥(注意复制私钥的时候头部的BEGIN...和尾部的END...都要复制过来)(前提:git上已添加对应的公钥),保存
在Credentials中选择添加的账号,报错就会消失(如果报错未消失可刷新页面,或选择后等待几秒报错就会消失)