4

I have setup my gitlab server behind a route, and I have mapped my ssh port to 50000 in the server. the gitlab port is 50001.Then I create a test project and try to clone it in another machine,it's ok when I use http.

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

but when I try to test it use ssh, it failed with

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

fatal: The remote end hung up unexpectedly

I have test my ssh setting with

ssh -vT git@myrouteaddress -p 50000

and it passed without problem.

I find out the auth with

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

and get the follow

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

can someone tell me the reason? Thank you very much!

yeluolei
  • 83
  • 1
  • 6

2 Answers2

2

I finally got the reason, I have generate the ssh rsa key with wrong parameter. the right way is:

ssh-keygen -t rsa -C "email@email.com"
yeluolei
  • 83
  • 1
  • 6
  • Excellent (that complements my own answer below), just like I like to create my ssh keys, as, for instance, in http://stackoverflow.com/a/16154236/6309 +1 – VonC Jun 01 '13 at 21:09
0

Check your config:

# 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

Then, try and use the scp syntax:

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

With a config file in your ~/.ssh/config with

Host gitolite
   Hostname myrootaddress # or ip address
   Port 5000 
   User git
   IdentityFile ~/.ssh/git
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have checked my config file, it passed all with green or OK.I have already write my `~/.ssh/config` file with hostname and port.I found I can's ssh to the remote host now. ssh myrouteaddress -p 50000 -l git PTY allocation request failed on channel 0 Welcome to GitLab, Anonymous! Connection to myrouteaddress closed. – yeluolei Jun 01 '13 at 09:43
  • @yeluolei so `ssh -Tv gitolite:user/test.git` doesn't work when your ~/.ssh/config is properly set? – VonC Jun 01 '13 at 10:15