4

我已经在路由后面设置了我的 gitlab 服务器,并且我已将我的 ssh 端口映射到服务器中的 50000。gitlab端口是50001。然后我创建一个测试项目并尝试将它克隆到另一台机器上,当我使用http时就可以了。

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

但是当我尝试使用 ssh 测试它时,它失败了

git remote add origin ssh://git@myrouteaddress:50000/user/test.git

fatal: The remote end hung up unexpectedly

我已经测试了我的 ssh 设置

ssh -vT git@myrouteaddress -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

有人可以告诉我原因吗?非常感谢!

4

2 回答 2

2

我终于找到了原因,我生成了带有错误参数的 ssh rsa 密钥。正确的方法是:

ssh-keygen -t rsa -C "email@email.com"
于 2013-06-01T16:56:46.153 回答
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 语法:

git@myrouteaddress:50000:user/test.git
or
gitolite:user/test.git

在你的with中有一个配置文件~/.ssh/config

Host gitolite
   Hostname myrootaddress # or ip address
   Port 5000 
   User git
   IdentityFile ~/.ssh/git
于 2013-06-01T07:31:07.360 回答