Jenkins git访问拒绝
问题一
Failed to connect to repository : Command "git ls-remote -h git@xxxxx.com:xxx/dev_test.git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please tryagain.
Permission denied, please try again.
Permission denied(publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly
原因:没有配置git的ssh key。
解决方法:执行下面的命令,生成key
ssh-keygen -t rsa -C "admin@example.com"
然后将~/.ssh/目录下的id_rsa.pub中的公钥,放到git的ssh key中。再在Jenkins中创建新的Credentials。类型是SSH Username with private key。Username使用ssh-keygen中用到的邮箱,Private Key中选择“From the Jenkins master ~/.ssh”即可。
修改后,问题解决。