![](/img/trans.png)
[英]Jenkins Failed to connect to repository : Command returned status code 128:
[英]Jenkins Git Plugin: Failed to connect to repository, returned status code 128
我正在嘗試克隆一個遠程GitHub企業存儲庫,並在我的Jenkins配置中將我的遠程repo的URL添加到Git插件后遇到以下錯誤:
hudson.plugins.git.GitException: Command "/usr/bin/git -c askpass=true fetch --tags --progress https://github.com/myUsername/myProject.git refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: fatal: unable to access https://github.myOrg.com/myUsername/myProject.git/': Failed to connect to github.com port 443: Operation timed out at...
配置細節和我嘗試過的事情:
問題:
我已經對此進行了幾天的故障排除,目前還不確定我的問題是什么! 請幫忙!!
關於第一個問題 - 您需要將正確的ssh密鑰與適當的存儲庫相關聯。 您可以在/var/lib/jenkins/.ssh/config
文件中執行此操作 - 詳細解釋在這里這是支持多個git repos的更強大的解決方案或者您可以在/.ssh
文件夾中添加正確的ssh密鑰。 對於疑難解答嘗試在jenkins框內的jenkins用戶下執行clone github repo。
關於你的第二個問題。 這是我在jenkins中的網絡設置,我沒有警告消息: /etc/hosts
: 127.0.0.1 localhost localhost.localdomain
/etc/sysconfig/network
: HOSTNAME=localhost.localdomain
。 您的主機名和localhost也應該在jenkins服務器中解析。
問題已經解決。 其次步驟這里新凱基。 登錄終端為:jenkins $(sudo -i -u jenkins)。 我最終能夠將新生成的密鑰添加到/Users/Shared/Jenkins/.ssh/id_rsa(我試圖在/Users/me/.ssh中重現我的其他ssh密鑰是如何存儲在我的mac上的)。
我還必須限制上述SSH密鑰文件夾的權限級別,以避免出現錯誤並使用ssh -T進行身份驗證並添加到git - >帳戶設置 - > ssh密鑰(特別是對於jenkins)。
之后,我進入Jenkins / configure並將我的新私鑰位置添加到CVS。 在我的項目中,我必須添加憑據(SSH用戶名w /私鑰)w /“來自Jenkins master~ / .ssh”單選按鈕。
這有點奇怪但是如果你使用gitlab.com,當你使用用於從Jenkins克隆項目的gitlab帳戶登錄網站(gitlab.com)時,似乎錯誤消失了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.