Git bash for Windows adds a local directory to remote config command?

Viewed 189

I have used Git Bash for Windows to clone a repository from a company intranet, and that repo should also have remote.origin.uploadpack and remote.origin.receivepack; so basically the procedure looks like:

git clone --upload-pack='\/home/windows/dept/REMUSER/git-core/git-upload-pack' ssh://LOCALUSER@.... new_git_folder
cd new_git_folder
git config remote.origin.uploadpack "/home/windows/dept/REMUSER/git-core/git-upload-pack"
git config remote.origin.receivepack "/home/windows/dept/REMUSER/git-core/git-receive-pack"

So, the clone passes, but when I do the first push, I get:

$ git push --all
LOCALUSER@....'s password:
bash: C:/Program: No such file or directory
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

So, I thought, what the heck - I've never used C:/Program anywhere?

Well, it turns out, first: if the argument to git config remote.origin.uploadpack is not quoted, as in:

git config remote.origin.uploadpack /home/windows/dept/REMUSER/git-core/git-upload-pack

... then the command sort of gets completely ignored (that is, when I do git config -l in the local repo folder, there is no mention whatsoever of remote.origin.uploadpack).

However, when quoted, as in the example above, it seems to write to the config - but it is completely wrong:

$ git config -l
...
remote.origin.uploadpack=C:/Program Files/Git/home/windows/dept/REMUSER/git-core/git-upload-pack
...

So, even if I specified git config remote.origin.uploadpack "/home/windows/dept/REMUSER/git-core/git-upload-pack" - for some reason, I still got the string C:/Program Files/Git - which is the local path to Git install - prepended to it?! WHY?! remote.origin.uploadpack doesn't even deal with local stuff?!

I've discovered, that if I start the remote.origin.uploadpack path value with a backslash, that is:

git config remote.origin.uploadpack "\/home/windows/dept/REMUSER/git-core/git-upload-pack"

... then this makes the repo (that is, git push) work - however, the backslash also ends up in the config:

$ git config -l
...
remote.origin.uploadpack=\/home/windows/dept/REMUSER/git-core/git-upload-pack
...

So, how should I specify the git config remote.origin.uploadpack path command, so that I do NOT get the local Git for Windows installation path prepended to it in the local git config - AND I do NOT end up with a backslash prepended to it either?

This was experienced on Windows 10, Git-2.19.0-64-bit.exe

0 Answers
Related