When Jenkins integrates Gitlab, the Source Code management adds Gitlab warehouse path regardless of how it tries to report the following two exceptions:
" git ls-remote-h [email protected]:xxx/dev_test.git HEAD " - : Stdout:stderr:Permission denied, please tryagain. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Fatal:the remote end hung up unexpectedly
Or
" /usr/local/git/bin/git-c core.askpass=true ls-remote-h http://www.xxx.com/gitlab/root/test.git HEAD " - Findfor'http'
The reason: Because the user running Jenkins does not generate an SSH private key and is not added in Gitlab. Therefore, the above exception is caused.
Generate SSH private key
Ssh-keygen " [email protected] "
Run the above command and enter it all the way to generate the corresponding private key.
To add a private key to Gitlab
Cat ~/. ssh/id_rsa.pub
Add all content to Gitlab-->profile settings-->ssh keys-->add an SSH key.
Restart Jenkins after saving.
Jenkins Gitlab Integration considerations