Bug 2859

Summary: git stopped to work when gitlab is running on nonstandard port
Product: Portable OpenSSH Reporter: tester <gglater62>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED INVALID    
Severity: major CC: dtucker
Priority: P5    
Version: 7.7p1   
Hardware: amd64   
OS: Linux   
Attachments:
Description Flags
Log of git pull none

Description tester 2018-04-17 03:13:11 AEST
After upgrade to openssh-7.7 git stopped to work.

url to git repository is something like:
ssh://git@gitlab.example.com:7456/something/something.git

Result of git pull:

bash: git-upload-pack: command not found
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Comment 1 Darren Tucker 2018-04-17 07:58:48 AEST
The error message seems to indicate that git-upload-pack is not in the $PATH on the server.

Could you please attach the ssh debug output?  Assuming a Bourne-ish shell, something like:

$ GIT_SSH_COMMAND='echo ssh $@ 1>&2; ssh -vvv' git pull

then attach the resulting log using "Add an attachment"?
Comment 2 tester 2018-04-17 19:55:25 AEST
Hm,
when I set GIT_COMMAND_SSH=ssh it works,
but when GIT_COMMAND_SSH is unset it does not.

For 7.6 it worked even when GIT_COMMAND_SSH was unset.
Comment 3 Darren Tucker 2018-04-17 20:29:16 AEST
OK, how about strace, eg:

$ strace -f -e trace=process git clone ssh://git@gitlab.example.com:7456/something/something.git

There should be a line something like
[pid 20798] execve("/usr/local/bin/ssh", ["/usr/local/bin/ssh", "-p", "7456", "git@gitlab.example.com", "git-upload-pack '/something/some"...], 0x561bec622a50 /* 43 vars */) = 0

which will show the arguments given to the ssh command.
Comment 4 tester 2018-04-17 23:46:13 AEST
Created attachment 3143 [details]
Log of git pull

It is a bit "obfuscated".
Comment 5 Darren Tucker 2018-04-17 23:58:17 AEST
(In reply to tester from comment #4)
> Created attachment 3143 [details]
> Log of git pull
> 
> It is a bit "obfuscated".

From the log:
> 17825 execve("/usr/bin/ssh-user", ["/usr/bin/ssh-user", "-G", "-p",
> "7456", "git@gitlab.example.com"], 0x14c30c0 /* 75 vars */) = 0

What's ssh-user and where does it come from?  It's being invoked by git before ssh.  It seems to end up running

/usr/bin/ssh -x -a -oClearAllForwardings=yes -l tester -p 7456 git@gitlab.example.com

which specifies contradictory usernames "tester" and "git".  The option parsing changed in 7.7 and now uses the first match, same as the rest of the config parsing.
Comment 6 tester 2018-04-18 01:37:25 AEST
Sorry, for noise.
I uninstalled ssh-user (okas) package.
It was set via GIT_SSH and now git works.
Sorry, and thanks for help.
Comment 7 Damien Miller 2018-10-19 17:17:30 AEDT
Close RESOLVED bugs with the release of openssh-8.0