2017-04-02 103 views
2

我有一個使用SSH密鑰對用戶進行身份驗證的git存儲庫,我想將該repo用作GoCD材質。 GoCD給我這個錯誤:如何設置GoCD來處理使用SSH密鑰進行身份驗證的私有git存儲庫?

Error performing command: --- Command --- 
git ls-remote ssh://[email protected]/repo.git refs/heads/master 
--- Environment --- 
{GIT_ALLOW_PROTOCOL=http:https:ssh:git:file:rsync} 
--- INPUT ---- 

--OUTPUT --- 

--- ERROR --- 
STDERR: Host key verification failed. 
STDERR: fatal: Could not read from remote repository. 
STDERR: 
STDERR: Please make sure you have the correct access rights 
STDERR: and the repository exists. 
--- 

有沒有什麼辦法可以將SSH密鑰添加到GoCD?

回答

1

在編寫本答案時,直接在GoCD中管理SSH密鑰是不可能的。爲了使它工作,您必須爲GoCD服務器和所有代理生成SSH密鑰,然後將它們添加到託管git存儲庫的服務器。您也可以將現有密鑰複製到服務器&節點,但顯然不建議這樣做。

例如,標準GoCD服務器安裝,你應該在你的系統中的「走出去」的用戶:

$ grep GoCD /etc/passwd 
go:x:998:998:GoCD User:/var/go:/bin/bash 

須藤爲「走出去」的用戶,並創建關鍵

$ sudo su - go 
$ ssh-keygen 
... 
$ ssh [server] 
The authenticity of host '[server] ([1.3.3.7])' can't be established. 
ECDSA key fingerprint is SHA256:Rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added '[server]' (ECDSA) to the list of known hosts. 
Permission denied (publickey,keyboard-interactive). 

的最後一步很重要,因爲如果你沒有做到,GoCD會給你同樣的錯誤。

現在將您的密鑰添加到git服務器並單擊GoCD中的「檢查連接」。它應該打印「連接正常」。

爲運行代理的每個節點和用戶生成密鑰。

相關問題