2016-05-13 49 views
-1

朋友們,我在Jenkins控制檯中收到以下錯誤。通過Jenkins連接到Git服務器的問題

"Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://[email protected]:29418/mobile HEAD" returned status code 128: 
stdout: 
stderr: Host key verification failed. 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists." 

嘗試了網絡上的所有選項。沒有工作。 這裏欣賞你的幫助

完整的日誌這裏

Building in workspace /Users/Shared/Jenkins/GIT 
Cloning the remote Git repository 
Cloning repository ssh://[email protected]:29418/mobile 
> git init /Users/Shared/Jenkins/GIT # timeout=10 
Fetching upstream changes from ssh://[email protected]:29418/mobile 
> git --version # timeout=10 
> git -c core.askpass=true fetch --tags --progress ssh://[email protected]:29418/mobile +refs/heads/*:refs/remotes/origin/* 
ERROR: Error cloning remote repo 'origin' 
hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress ssh://[email protected]:29418/mobile +refs/heads/*:refs/remotes/origin/*" returned status code 128: 
stdout: 
stderr: Host key verification failed. 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

感謝, 馬達夫

+0

我沒有創建的.ssh文件夾,並能夠連接通過命令提示符(終端)到GIT。我使用OS X BTW –

+0

您是否能夠使用ssh在沒有jenkins的情況下克隆本地系統上的回購? –

+0

絕對如此。它確實如此。但有時我必須運行此命令/ n ssh-add .ssh/id_rsa/n以使克隆命令正常工作唯一問題通過Jenkins –

回答

1

我認爲這是對你的.ssh文件夾或id_rsa *文件權限問題。

請看看這篇文章,以設置正確的權限: https://superuser.com/questions/215504/permissions-on-private-key-in-ssh-folder

你的.ssh文件夾應該在你的詹金斯用戶(類似的/ home /詹金斯或/ var/lib中的主文件夾中存在/詹金斯)。

的權限應該是:

  • 的.ssh文件夾:700(drwx ------)
  • 公鑰(的.pub):644(-rw-R - R-- )
  • 私鑰(id_rsa):600(-rw -------)

請確認您的固定問題:)

+0

感謝Bruno。但權限設置爲777,就像完全訪問一樣。還是同樣的問題馬達夫的iMac:馬達夫管理員$ ls -l命令的.ssh/ 共有16 -rwxrwxrwx 1詹金斯人員3326 5月12日18:44 id_rsa -rwxrwxrwx 1詹金斯人員763 5月12日18:44 id_rsa.pub –

+0

還,Jenkins如何知道.ssh文件夾的位置? –

+0

我已經更新了我的答案。您必須使用.ssh文件夾和id_rsa *文件的確切權限。否則,您的密鑰將無法識別。 –