1. Gitlab adds the public key of the jenkins server
- jenkins generate secret key command
ssh-keygen -t rsa
2. Jenkins secret key address:
cd /root/.ssh
3. Copy the public key to gitlab to add
cat id_rsa_pub
4. Add private key to jenkins
cat id_rsa
5. Binding (if it goes well, it will end here)
(This picture is the picture when it is successful)
6. The solution to the connection failure
First use git to clone the ssh address of the project that needs to be helped.
It is found that git can pull the gitlab project
. At this time, Find the following files in the key directory
cd /root/.ssh
At this time, go to jenkins to bind the project with ssh credentials and no longer report an error.
Try to build the project successfully: