我已经在路由后面设置了我的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
它没有问题。
我用
找出了authsudo 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 :(得分:2)
我终于明白了,我用错误的参数生成了ssh rsa键。正确的方法是:
ssh-keygen -t rsa -C "email@email.com"
答案 1 :(得分: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
使用config file in your ~/.ssh/config
Host gitolite
Hostname myrootaddress # or ip address
Port 5000
User git
IdentityFile ~/.ssh/git