2

When creating a new project, on the final step gitlab give me instructions to setup my repo, but the URL to the repo don't work. For instance, to add remote branch, I got:

git remote add origin git@git.srv.com:root/home.git

Note: My gitlab instance is running on a virtual machine whom host forward SSH's requests on port 1122 to the VM's port 22. So locally gitlab is reach on port 22.

Given URL doesn't work

Pushing

Keep asking for password. Neither my SSH passphrase nor my account's password works:

git push -u manu master                                        
Password: 
Password: 
Password: 
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly

Cloning

Same here, keep prompting for password:

git clone git@git.srv.com:1122/root/home.git      
Cloning into 'home'...
Password: 

Fixing the URL (add protocol and port)

If I simply add a ssh:// prefix and the port to the server (:1122/) everything work smoothly:

git remote add manu ssh://git@git.srv.com:1122/root/home.git
Édouard Lopez
  • 40,270
  • 28
  • 126
  • 178

1 Answers1

0

The surest way to debug this kind of ssh access is to launch an sshd -d session on the server and see the output (it is a one-time debug connection).

Note that git@git.srv.com:root/home.git is an url using an scp syntax, which means you have a ~/.ssh/config file, with an entry named git.srv.com, which can reference your private key (IdentityFile), as in this question for instance.
You can also check its content to see if it does contain the right value (including the right Port)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The SSH works fine, but gitlab interface doesn't display the port `1122` so URL given are incorrectly build. I don't get any `~/.ssh/config` file in my `/home/git` directory, I will check that. – Édouard Lopez Jun 22 '13 at 00:35
  • 1
    @EdouardLopez I confirm that if you don't have a `~/.ssh/config` **on the client side** (*not* on the server `git` account, but on the machine where you try to ssh your way to the gitlab server), a syntax like `xxx:yyy` (with a '`:`') won't work. – VonC Jun 22 '13 at 18:37
  • I'm looking for a server-side solution – Édouard Lopez Jun 23 '13 at 10:15
  • @EdouardLopez but your git clone command is done on the client side, right? Hence my previous comment. – VonC Jun 23 '13 at 10:53
  • Yep, but I a server-side solution will be a lot more sure – Édouard Lopez Jun 23 '13 at 10:58
  • @EdouardLopez either way, an scp syntax means you have to have a `~/.ssh/config` file. – VonC Jun 23 '13 at 11:23
  • Understood that and thanks for the knowledge, but that's not my initial question. – Édouard Lopez Jun 24 '13 at 06:10