Jenkins specify the source code on the Gitlab, the prompt does not have permission

Source: Internet
Author: User
Tags ssh

This article is used to record the problems encountered when Jenkins integration;

Reference documentation 1:http://www.jianshu.com/p/ed0edb93e234

Problem Description: Jenkins specify the source code on Gitlab, the prompt does not have permission

Problem reason: You need to use the Jenkins user generated SSH key, place the key in Jenkins, and put the public key in Git.

The method is as follows:

1. In installing Jenkins Linux machine, add Jenkins User, set password; I have the Jenkins user here, and then I modified the password of the Jenkins user.

[Dev@vhost6/]$ cat/etc/passwd | grep Jenkins
Jenkins:x:992:989:jenkins Continuous Integration Server:/var/lib/jenkins:/bin/false

[Dev@vhost6 jenkins]$ sudo passwd Jenkins
[sudo] password for dev:
Change the user Jenkins password.
New Password:
Re-enter the new password:
PASSWD: All authentication tokens have been successfully updated.


2. Switch to Jenkins User;

[Dev@vhost6 jenkins]$ Su-jenkins
Password:
Last Login: 43 months 9 18:30:26 CST 2017PTS/1 on
[Dev@vhost6 jenkins]$ LL
Total dosage 0
[Dev@vhost6 jenkins]$ pwd
/var/lib/jenkins


3. Generate SSH Key

[Dev@vhost6 jenkins]$ ssh-keygen-t rsa-c "Your mailbox"-F ~/.ssh/jenkins
generating public/private RSA key pair.
Enter passphrase (empty for no passphrase):  
Enter same passphrase;
again:  Your identification Saved In/home/dev/.ssh/jenkins. (The private key is saved here)
Your Public key has been saved. (Here is the key to save) br> The key fingerprint is:
09:b3:2e:94:ea:c2:45:9a:b6:79:07:47:56:bf:df:af ylzyyy2016@126.com
The key ' s Randomart image is:
+--[RSA 2048]----+
|                 |
|   & nbsp  .         |
|      +.        |
|  . + + o       |
|  + =. S.      |
| + = o         |
|o = +.  .    |
|. = . o    . .   |
|. O.        eo |
+-----------------+

4. Put the public key into the Gitlab, the location is: Http://IP address/profile/keys,add an SSH key interface

Title can be arbitrarily named, the public key into the key input box, click the Add Key button to save.

The public key looks like this:

Ssh-rsa aaaab3nzac1yc2eaaaadaqabaaabqdiacy1jhmgm/3fjcqdiacy1jhwk3oxpewg/ Pothqqlxfeq8djn0bdleesivysgrzzgucqvv3x8iaklogup8g3izjg5i4yqibsteugq2aw6t9vb2sykroifhid8ndxq0cbvcdz4nvslroz4qdiacy1jh +jvoc2oqdiacy1jhqdiacy1jhsq59ga+rdwsgndar0mobmyfjgxwsdnk4iapajhhzzbxmxantr1gr4xkwj4eheo2cpd7qcsauo7jy+yfjfzxb/ O4ghy9stpeeqdp/yzzdr/qzyqdgv78n+sypgxhh+u0cszdmnbtjuknnocyxnegwuvvygttptzlbospot9 xxxxxx@xxx.com



5. Put the private key into the Jenkins, bad description, directly put the picture, followed by the steps of the picture to go well;

1)


2 attention to the place

1:kind to select SSH ... ”

2:username to fill in the Jenkins

3:private key Entry, select enter directly and fill in key;

Enter password in 4:passphrase

5: Click "Add" to save


3) Credentials item Selection Jenkins, Jenkins should be automatically linked to a gitlab, just started to report the error is not




By this, the problem will be solved.

Thanks to the authors of the various documents that gave me help.






















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.