Windows的Git bash将本地目录添加到远程配置命令?

时间:2018-09-14 08:56:09

标签: windows bash git

我已经使用Windows的Git Bash从公司内部网克隆存储库,该存储库也应具有remote.origin.uploadpackremote.origin.receivepack;所以基本上过程如下:

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"

因此,克隆通过了,但是当我进行第一次推送时,我得到了:

$ 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.

所以,我想,这到底是什么-我从未在任何地方使用过C:/Program

首先,结果是:如果未引用git config remote.origin.uploadpack的参数,例如:

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

...然后将完全忽略命令的排序(即,当我在本地存储库文件夹中执行git config -l时,没有提及remote.origin.uploadpack的任何内容)。

但是,如上例中所述,在引用时,它似乎写入了配置-但这是完全错误的:

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

因此,即使我出于某种原因指定了git config remote.origin.uploadpack "/home/windows/dept/REMUSER/git-core/git-upload-pack",我仍然得到字符串C:/Program Files/Git-这是Git安装的本地路径-在它之前吗?为什么?! remote.origin.uploadpack甚至不处理本地内容?!

我发现,如果我以反斜杠开头remote.origin.uploadpack路径值,即:

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

...然后,这使存储库(即git push)起作用-但是,反斜杠也以配置结尾:

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

所以,我应该如何指定git config remote.origin.uploadpack path命令,以免在本地git config中无法获得Windows本地安装的Git for Windows安装路径-并且我不会以反斜杠结尾也可以吗?

这是在Windows 10 Git-2.19.0-64-bit.exe

上遇到的

0 个答案:

没有答案