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!
I finally got the reason, I have generate the ssh rsa key with wrong parameter. the right way is:
Check your config:
Then, try and use the scp syntax:
With a config file in your
~/.ssh/config
with