Jenkins solve error when connecting git Permission denied (publickey)

Permission denied error when Jenkins solve connection git (publickey)

environment
Ubuntu 18.04 LTS
Jenkins 2.164.3. By apt install jenkins installation.

The reason
results are apt to install jenkins Jenkins created a user, and the user to run as a service. So whether it is the root or the current user's ssh key is not in force.

Solve
the reason can be seen, there are two solutions. One is to modify the user jenkins runtime, which is Baidu out of answers. It should be noted that the current version, JENKINS_USER this variable is in the / etc / default / jenkins changed here.
Another is for the user to regenerate the jenkins ssh key, and then set the system to git. Methods as below:

the root SU
CD /var/lib/jenkins/.ssh
SSH-keygen -t RSA -C [email protected]
# Note prompted to save the next position, the input again
/var/lib/jenkins/.ssh/ id_rsa
# the Enter the Save to File in Which at The Key (/root/.ssh/id_rsa): /var/lib/jenkins/.ssh/id_rsa
chown Jenkins: Jenkins id_rsa id_rsa.pub
CAT id_rsa.pub

original link: https: // hursing.blog.csdn.net/article/details/90521031

Guess you like

Origin www.cnblogs.com/diyhlgc/p/12587318.html