2013-06-01 119 views
4

我已經在路由後面設置了我的gitlab服務器,並且已將我的ssh端口映射到服務器中的50000。 gitlab端口是50001.然後我創建一個測試項目並嘗試在另一臺機器上克隆它,當我使用http時可以。gitlab 5.2可以通過http進行克隆和推送,但無法通過ssh克隆或推送

git remote add origin http://myrouteaddress:50001/user/test.git 

但是當我嘗試測試它使用ssh,它

git remote add origin ssh://[email protected]:50000/user/test.git 

fatal: The remote end hung up unexpectedly 

失敗我測試我的ssh設置與

ssh -vT [email protected] -p 50000 

,並通過沒有問題。

我發現與

sudo tail -f /var/log/auth.log 

的權威性,並得到遵循

Jun 1 12:29:22 debian sshd[24799]: Accepted publickey for git from mytestpcip port 37848 ssh2 
Jun 1 12:29:22 debian sshd[24799]: pam_unix(sshd:session): session opened for user git by (uid=0) 
Jun 1 12:29:22 debian sshd[24801]: Received disconnect from mytestpcip: 11: disconnected by user 
Jun 1 12:29:22 debian sshd[24799]: pam_unix(sshd:session): session closed for user git 

有人可以告訴我原因嗎?非常感謝你!

回答

0

檢查你的配置:

# check gitlab-shell install 
sudo -u git -H /home/git/gitlab-shell/bin/check 

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

然後,嘗試並使用SCP的語法:

[email protected]:50000:user/test.git 
or 
gitolite:user/test.git 

隨着config file in your ~/.ssh/config

Host gitolite 
    Hostname myrootaddress # or ip address 
    Port 5000 
    User git 
    IdentityFile ~/.ssh/git 
+0

我檢查我的配置文件,它通過了所有與綠色或OK.I已經寫我的'的〜/ .ssh/config'文件,主機名和port.I發現我能的SSH到現在的遠程主機。 ssh myrouteaddress -p 50000 -l git PTY分配請求在通道0上失敗 歡迎使用GitLab,Anonymous! 連接到myrouteaddress關閉。 – yeluolei

+0

@yeluolei so'ssh -Tv gitolite:user/test.git'在您的〜/ .ssh/config設置正確時不起作用? – VonC

2

我終於拿到了原因,我有用錯誤的參數生成ssh rsa密鑰。正確的方法是:

ssh-keygen -t rsa -C "[email protected]" 
+0

優秀(這補充了我自己的答案),就像我喜歡創建我的SSH密鑰,例如,在http://stackoverflow.com/a/16154236/6309 +1 – VonC