jenkins gitlab整合注意事項

jenkins整合gitlab時,Source Code Management添加gitlab倉庫路徑不管怎麼嘗試都報以下兩個異常:git

Failed to connect to repository : Command"git ls-remote -h git@xxxxx.com:xxx/dev_test.git HEAD"returned status code128:api

stdout:ssh

stderr: Permission denied, please tryagain.gitlab

Permission denied, please try again.code

Permission denied(publickey,gssapi-keyex,gssapi-with-mic,password).rem

fatal: The remote end hung up unexpectedlyjenkins

it

Failed to connect to repository : Command"/usr/local/git/bin/git -c core.askpass=true ls-remote -h http://www.xxx.com/gitlab/root/test.git HEAD"returned status code128:io

stdout:test

stderr: fatal: Unable tofindremote helperfor‘http‘

緣由是:因爲運行jenkins用戶沒有生成ssh私鑰,且沒有添加gitlab中。所以致使瞭如上異常。

生成ssh私鑰

ssh-keygen-t rsa -C"admin@example.com"

運行上述命令,並一路回車便可生成相應的私鑰。

將私鑰添加到gitlab

cat~/.ssh/id_rsa.pub

將全部內容添加到gitlab-->Profile Settings-->SSH Keys-->Add an SSH key。

保存後重啓jenkins便可。

相關文章
相關標籤/搜索