2013-07-19 133 views
14

我是gitlab和CI新手,所以我有很多問題,但其中一些通過谷歌,SO,git人解決,但不是最後一個...無法通過SSH克隆gitlab的回購,通過http - 好吧

如果我嘗試通過HTTP克隆回購協議,我不能克隆通過ssh =(

回購:

[email protected]:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
Username for 'http://gitlab.vbox': root 
Password for 'http://[email protected]': 
warning: You appear to have cloned an empty repository. 

沒關係

但是通過ssh ...

[email protected]:/var/www$ git clone [email protected]:root/virtualboxgitlab.git 
Cloning into virtualbox 'gitlab' 
[email protected]'s password:<br /> 

它提示我混帳的密碼,我沒有創建在安裝過程中(如我的人有)

rsa keys 

我通過gitlab的網站加入我的鑰匙(佔根,其實我沒有創造任何其他帳戶)

而且也是我所說的「貓my_rsa.pub >> authorized_keys的」

我讀到這裏幾個職位有關SSH的煩惱,但大多數gitolite安裝

添加關鍵

我安裝gitlab 5.3沒有gitolite(如手冊),可能是我應該?

我也試過ssh -vT [email protected]它輸出:

.... 
debug1: Server host key: ECDSA 48:83:ba:b3:37:72:a0:dc:ca:2c:a3:b8:78:a1:c4:ad 
debug1: Host 'gitlab.vbox' is known and matches the ECDSA host key. 
debug1: Found key in /home/lesha/.ssh/known_hosts:2 
debug1: ssh_ecdsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: Roaming not allowed by server 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Offering RSA public key: /home/lesha/.ssh/id_rsa 
debug1: Authentications that can continue: publickey,password 
debug1: Trying private key: /home/lesha/.ssh/id_dsa 
debug1: Trying private key: /home/lesha/.ssh/id_ecdsa 
debug1: Next authentication method: password 
[email protected]'s password: 


[email protected]:/home/git/.ssh# ls -l 
итого 4 
-rw------- 1 git git 922 Июл 18 21:05 authorized_keys 

environmetnt: 的debian 7,nginx的+乘客,gitlab 5.3,紅寶石2.0.0p247,沒有gitolite,對麒麟

請幫助美洲獅! =)卻困...


一些補充(2013年7月20日):

我創建的用戶的git在手動安裝

sudo adduser --disabled-login --gecos 'GitLab' git 

第二天,我想殺混帳和useradd命令只是重新添加,在那之後我的鑰匙都工作,但我仍然不開心,因爲:

[email protected]:/var/www$ git clone [email protected]:root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
fatal: 'root/virtualboxgitlab.git' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly 

和HTTP工作以及以往:

[email protected]:/var/www$ git clone http://gitlab.vbox/root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
Username for 'http://gitlab.vbox': root 
Password for 'http://[email protected]': 
warning: You appear to have cloned an empty repository. 

所以,現在我沒有權威性的問題,但還有一個。

如何解決此問題?

+0

我已經編輯我的答案迴應你的問題的編輯:) – VonC

回答

5

GitLab 5.x doesn't use gitolite anymore,但是gitlab-shell

我建議創建一個專用帳戶,如installation process中的建議。

ssh [email protected] 

了SSH命令意味着你所要求的安全外殼上「gitlab.vbox」作爲用戶「git」。如果該用戶不存在...它將無法工作。

沒有必要去嘗試和克隆回購是測試運行不正常:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production 

OP報告ssh可以創建git的用戶並添加鍵後好轉,但:

  • 首先請確保您在「客戶」帳戶上創建了您的密鑰,而不是在~git/.ssh/id_rsa中:您正嘗試從客戶帳戶中打開一個會話爲gitgit是安裝gitlab的帳戶。
  • 然後,您應該將您的公鑰註冊到您通過gitlab gui聲明的用戶帳戶的ssh頁面中。你應該而不是useradd」ssh到根。

如果你看到這一點:

[email protected]:/var/www$ git clone [email protected]:root/virtualboxgitlab.git 
Cloning into 'virtualboxgitlab'... 
fatal: 'root/virtualboxgitlab.git' does not appear to be a git repository 
fatal: The remote end hung up unexpectedly 

這也意味着你不應該指定回購的路徑(root/):

git clone [email protected]:virtualboxgitlab.git 

這是gitlab工作,知道在哪裏virtualboxgitlab .git被存儲(如其在gitlab.yml配置文件中指定的)

基本上,忘記根目錄,並按照它的意圖完整安裝gitlab:在'git'帳戶中。

的OP使它工作,他評論說:

root」是管理員命名空間,gitlab自動創建此URL,並沒有它的克隆是不行的,現在一切克隆,我開始安裝gitlab CI ,

的OP必須:

我的用戶到sudo組,變乾淨安裝,收到錯誤

/usr/local/lib/ruby/2.0.0/net/http.rb:878:in initialize': getaddrinfo: 
    Name or service not known (SocketError) 

無法解析主機名,添加gitlab.vbox/etc/hosts

+0

我folowed安裝嚮導一步一步的,沒有錯誤,只有:'Git爲git用戶配置? git:x:1001:1001:GitLab ,,,:/ home/git:/ bin/bash' – alexZT

+0

將我的用戶添加到sudo組中,進行全新安裝,收到錯誤' /usr/local/lib/ruby/2.0.0/net/http.rb:878:in'initialize':getaddrinfo:無法解析主機名的名稱或服務未知(SocketError)',將gitlab.vbox添加到'/etc/hosts'現在我快樂了!=)關於回購路徑的一個詞,你告訴我不應該指定root /在路徑中,我這樣做,我應該,「根」是管理員命名空間,gitlab自動創建此網址,沒有它克隆不起作用,現在一切克隆和我開始安裝gitlab CI,非常感謝 – alexZT