Jenkins Link Gitlab

Source: Internet
Author: User
Tags ssh git client git clone

First, create a new project on Gitlab, add Users:

1. Create New project:


Permission levels are divided into three types:

1 private, only you or members of the group can access
2) Internal all logged in users
3 Public, everyone can access

2, add SSH key:

The code transfer protocol between GIT warehouses primarily uses the SSH protocol. While the general build Gitlab use of the git user is not password, so direct ssh is not able to log in. You need to generate the public key locally using Ssh-keygen, upload it to the Gitlab, and use an asymmetric encrypted transmission.

1 Generate SSH key public key:

2 on the Gitlab panel, click Profile settings–> ssh keys–> Add ssh Keys in turn. Then copy the contents of the id_rsa.pub in the previous step and paste it into the input box to save it.

3 Install the Git client locally, and then use the following command to clone the server project code to Local:

git clone XXX


3, add Users:

At this point, the project is only visible to you, and someone else needs to add someone else's Gitlab user to the group (the group that was selected when the project was created).




Second, Jenkins link Gitlab:

1, first installed on the Jenkins git plugin;

2, if Jenkins is on the server, can be a gitlab on the user, then on the Gitlab as the above will Jenkins users to the group can be. (Can be Jenkins on the server, with git command can clone first to the project to verify)

3, if the Jenkins is not on the server as a Gitlab users, then there are two ways to solve. One is to add the Sshkey of the Jenkins server on the Gitlab and enable it, and then add a Gitlab user's username, password (for the user who has permission to the project) on the Jenkins;

1) Add SSK key:


And then



Click Save and then enable.

2 on Jenkins, add the user name and password of Gitlab User:



4, another method is: directly on the Jenkins to add Gitlab user's private key:

1) Enter Jenkins:


2) Add private key:


Select the SSH private key, enter the user name, private key (Gitlab on the project has permissions on the user, the user on the gitlab of the public key to upload the corresponding private key).






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.