当我克隆到通过绝对路径引用的目录(不存在)时,git 不会抱怨任何事情,报告 0 退出代码,但目录是not创建的。 Git 遵守目录do当我重试时存在:
user@host /tmp
$ git clone https://github.com/zandev/shunit2.git /tmp/shunit01
Cloning into '/tmp/shunit01'...
remote: Counting objects: 1219, done.
emote: Total 1219 (delta 0), reused 0 (delta 0), pack-reused 1219
Receiving objects: 100% (1219/1219), 308.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (657/657), done.
Checking connectivity... done.
user@host /tmp
$ echo $?
0
user@host /tmp
$ ls /tmp/shunit01
ls: cannot access /tmp/shunit01: No such file or directory
user@host /tmp
$ git clone https://github.com/zandev/shunit2.git /tmp/shunit01
fatal: destination path '/tmp/shunit01' already exists and is not an empty directory.
user@host /tmp
$ echo $?
128
从 cygwin、powershell 或 Windows UI 检查时,这些目录似乎不存在。我没有看到任何任何错误的迹象。管理员帐户也存在同样的问题。
当使用非绝对路径时,我可以正确克隆存储库(shunit02
, 甚至../tmp/shunit02
).
Using:
- Windows 7 企业版 6.1 内部版本 7601 服务包 1
- git 2.5.1.windows.1
- 赛格温2.3.1-1
EDIT:
The /tmp
目录被视为C:\cygwin64\tmp
通过窗户。我用了/tmp
例如,同样的情况发生在/cygdrive/c
实际上。
EDIT 2:
我正在使用 Windows 版 Git。当使用 Windows 路径作为目标时,克隆可以工作,例如:git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
这是由于适用于 Windows 的 Git 不接受 cygwin 路径 https://github.com/git-for-windows/git/issues/568, 所以/a/b/c
被翻译成c:\a\b\c
。事实上,这就是存储库被克隆的地方,它解释了为什么后续克隆尝试失败。该目录实际上存在,尽管真正的目的地是意外的。
什么会起作用?
- 使用附带的 bash适用于 Windows 的 Git和他们的路径约定,
- 使用接受cygwin路径的cygwin git(据报道,可能还有其他问题),
- 使用本机 Windows 路径:
git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
,
- 使用相对目标名称,因为它似乎可以正常工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)