I have a git
(version 2.1.2
) repository with an ssh
remote:
$ git remote -v
origin ssh://dettorer@dettorer.net:/home/dettorer/my_project (fetch)
origin ssh://dettorer@dettorer.net:/home/dettorer/my_project (push)
Which fails to push:
$ git push
Bad port ''
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Unless… I use the --verbose
switch:
$ git push --verbose
Pushing to ssh://dettorer@dettorer.net:/home/dettorer/my_project
Enter passphrase for key '/home/dettorer/.ssh/id_rsa':
Counting objects: 7, done.
...
To ssh://dettorer@dettorer.net:/home/dettorer/my_project
e633fe9..5d2e9de master -> master
updating local tracking ref 'refs/remotes/origin/master'
I augmented the ssh
log level as hinted in that answer, but the output for git push
(without --verbose
) was the exact same.
Where could it come from?
As nwinkler suggested, here is the output of the two commands with GIT_TRACE=2
:
$ GIT_TRACE=2 git push
13:42:33.002392 git.c:349 trace: built-in: git 'push'
13:42:33.033594 run-command.c:341 trace: run_command: 'ssh' '-p' '' 'dettorer@dettorer.net' 'git-receive-pack '\''/home/dettorer/my_project'\'''
Bad port ''
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
$ GIT_TRACE=2 git push -v
13:42:39.929236 git.c:349 trace: built-in: git 'push' '-v'
Pushing to ssh://dettorer@dettorer.net:/home/dettorer/my_project
13:42:39.944837 run-command.c:341 trace: run_command: 'ssh' 'dettorer@dettorer.net' 'git-receive-pack '\''/home/dettorer/my_project'\'''
Enter passphrase for key '/home/dettorer/.ssh/id_rsa':
So unless I use --verbose
, there indeed is an extra '-p'
option with an empty argument.
EDIT: this is getting more obscure:
$ git push origin
Bad port ''
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git remote add test test
$ git push origin
Enter passphrase for key '/home/dettorer/.ssh/id_rsa':
$ git remote remove test
$ git push origin
Bad port ''
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.