2013-10-26 101 views
2

我剛剛建立了一個專用於GitLab的Ubuntu 64位服務器。GitLab和SSH/HTTP連接

我已經成功安裝了GitLab,除了使用Git客戶端(SmartGit)的SSH連接外,其他一切似乎都正常工作。

我點擊 「克隆」,然後我插入SSH git的URL:

[email protected]:root/firstproject.git 

當我點擊 「下一步」,它給了我這個錯誤:

Please check the repository URL. 

Could not read from remote repository.: /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'initialize': getaddrinfo: Name of service not know (SocketError) 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'open' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'block in connect' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'timeout' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'connect' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'do_start' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'start' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'get' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'allowed?' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'validate_access' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'exec' 
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in '<main>' 
Please make sure you have the correct access rights and the repository exists. 

我曾嘗試生成一個SSH密鑰並將其放入/home/git/.ssh/config,但問題依然存在。
我甚至使用網頁瀏覽器中的Gitlab控制面板將它添加爲「鍵」。

我試圖重新啓動GitLab和SSH,但它沒有幫助。 的HTTP方法可行,但給了我一個錯誤,如果我在同一時間commint &推很多文件:

The remote end hung up unexpectedly 
The remote end hun up unexpectedly 
RPC failed; result=22, HTTP code = 411 

Counting objects: 89, done 
Delta compression using up to 8 threads. 
Total 88 (delta 12), reused 0 (delta 0) 

我不需要解決這兩個問題,我只需要完全具備其中之一加工。

+0

我增加了nginx.conf的max_file_size,現在HTTP方法起作用了。如果有人知道如何修復SSH方法,請在此處添加答案。 –

+0

您能否將錯誤的文本版本替換爲圖片?你可以谷歌文本,而不是圖片。 – VonC

+0

新增文字版 –

回答

0

確保這不是配置問題,如報告issue 3324

sudo -u git -H vim /home/git/gitlab-shell/config.yml 

and change:

gitlab_url: http://yourhost to gitlab_url: http://yourhost/ 

Slash at the end is important.

+0

我已經擁有了。 –

2

從堆棧跟蹤,它看起來像gitlab-shell無法解決DNS服務器自己的主機名來驗證與庫權限GitLab的web API。嘗試登錄到服務器並運行:

nslookup mydomain.test

其中「mydomain.test」是你在使用gitlab.ymlgitlab_url:設置的主機名。如果在輸出中看到類似** server can't find mydomain.test的錯誤,這是您的問題。

如果是這樣,你可以通過解決這個問題:

  1. 通過編輯/etc/resolv.conf,以便它可以正確地解析主機名糾正你的服務器的DNS配置。您需要添加的DNS服務器取決於您的託管環境;您必須與管理您的網絡的人員進行溝通以找到適當的值。
  2. gitlab_url更改爲使用http://localhost/而不是可外部路由的域名。
  3. 在您的服務器上爲mydomain.test添加條目/etc/hosts,該條目指向127.0.0.1。
+0

服務器不能解析本地主機...我用膩子密鑰生成器生成了一個新密鑰,將公鑰添加到服務器,在SmartGit中詢問時加載私鑰,現在它不會給出錯誤,但是繼續詢問ssh密鑰... –

+0

好的我已經添加到我的DNS服務器的DNS規則指向Git服務器的IP,現在nslookup可以正確使用「mydomain.test」,但是當我嘗試登錄它時繼續問我ssh密鑰... –

+0

你被提示輸入SSH密碼的密碼,或輸入服務器的密碼('[email protected]'s password:')?如果是SSH密碼,則密碼錯誤輸入或密鑰損壞;如果它是服務器的密碼,可能是你的'〜git/.ssh/authorized_keys'文件存在問題。 –