Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 从cygwin bash成功克隆后,本地Git存储库不存在_Windows_Git_Cygwin - Fatal编程技术网

Windows 从cygwin bash成功克隆后,本地Git存储库不存在

Windows 从cygwin bash成功克隆后,本地Git存储库不存在,windows,git,cygwin,Windows,Git,Cygwin,当我克隆到通过绝对路径引用的目录(不存在)时,git不会抱怨任何事情,报告0退出代码,但目录未创建。当我重试时,Git遵守目录是否存在: 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), reu

当我克隆到通过绝对路径引用的目录(不存在)时,git不会抱怨任何事情,报告0退出代码,但目录未创建。当我重试时,Git遵守目录是否存在:

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检查时,这些目录似乎不存在。我没有看到任何错误的迹象。对于管理员帐户,也可以观察到同样的问题

使用非绝对路径时,我可以正确克隆repo(
shunit02
,甚至
。/tmp/shunit02

使用:

  • Windows 7 Enterprise 6.1版生成7601 Service Pack 1
  • git 2.5.1.windows.1
  • cygwin 2.3.1-1
编辑:

windows将
/tmp
目录视为
C:\cygwin64\tmp
。我以
/tmp
为例,事实上在
/cygdrive/c
中也会发生同样的情况

编辑2:


我正在使用Git for Windows。当对目标使用widows路径时,克隆可以工作,例如:
git clonehttps://github.com/zandev/shunit2.git “C:\cygwin64\tmp\shunit4”

是否可以尝试重命名现有的
/tmp
并在cygwin安装文件夹中重新创建它,如中所述:

建议1 问:在我安装cygwin并启动它之后,它提供了 以下消息:bash.exe:警告:找不到/tmp,请 创造!bash:/etc/profile:无效参数bash:/。bash\u profile: 无效参数

答:您需要首先创建/tmp目录。A发出你的声音 cygwin根目录称为C:/cygwin,这意味着您应该 首先创建目录C:/cygwin/tmp

建议2 似乎您正在Cygwin中使用Git Bash for Windows的Git可执行文件。可能值得尝试使用Cygwin本身提供的git可执行文件。

这是由git for Windows造成的,因此
/a/b/c
被翻译为
c:\a\b\c
。事实上,这就是存储库被克隆的地方,它解释了为什么后续的克隆尝试会失败。该目录实际上存在,尽管真正的目的地是意外的

什么有效?
  • 使用Git for Windows附带的bash及其路径约定
  • 使用接受cygwin路径的cygwin git(据报道,可能还有其他问题)
  • 使用本机windows路径:
    git克隆https://github.com/zandev/shunit2.git “C:\cygwin64\tmp\shunit4”
  • 使用相对目标名称,因为它似乎没有问题

您能告诉我们tmp文件夹的权限吗?此外,tmp文件夹的绝对位置是什么(即
cygpath-w-p/tmp
的输出是什么,或者如果您使用
cd/tmp&&explorer.
打开哪个文件夹?),我没有观察到问题中的任何症状。但是,我已经重新创建了
/tmp
,问题仍然存在。谢谢,是否值得尝试使用Cygwin提供的git可执行文件而不是msysgit来查看问题是否可以重现?