jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理

问题背景:
jenkins服务器发布代码后需要执行删除缓存的操作
ssh -p222 eus_pe_devadmin@1.1.1.1 "sudo rm -rf /dev/shm/nginx/hipdf/cache/*"

分析:
要让jenkins能删除远程服务器上的缓存,需要配置免秘钥打通
为避免权限过大,使用 eus_pe_devadmin 操作,即jenkins服务器上运行tomcat服务的apache用户操作远程 eus_pe_devadmin 用户来删除缓存
需要把运行jenkins程序的apache用户公钥拷贝到远程服务器的目标用户: /home/eus_pe_devadmin/.ssh/authorized_keys 中,发现apache用户下没有公钥,于是手动ssh-key-gen生成了新的私钥和公钥

发现jenkins不能连接git代码仓库,所有的代码都不能发布

报错:
Failed to connect to repository : Command "/usr/bin/git ls-remote -h git@xx.com.git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理

jenkins发布报错
jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理
Please make sure you have the correct access rights
and the repository exists.

解决办法:

登录连接git仓库的账号,配置对应的ssh_key即可

jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理

jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理

上一篇:linux设置公钥免密登录问题解决


下一篇:java – 解密OpenLDAP密码