本地Git存储库不存在从成功克隆从cygwin bash [英] Local Git repository does not exist after sucessfull clone from cygwin bash

查看:166
本文介绍了本地Git存储库不存在从成功克隆从cygwin bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我克隆到通过绝对路径引用的目录(不存在)时,git不会抱怨任何东西,报告0退出代码,但目录是创建。重试时,Git符合目录 do

When I clone to the directory (that does not exists) referred to via absolute path, git does not complain about anything, report 0 exit code but the directory is not created. Git complies the directory do exist when I retry:

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检查时,目录似乎不存在。我没有看到任何种类的错误的任何迹象。

The directories does not seem to exist when checked from cygwin, powershell or Windows UI. I have not seen any indication of an error of any kind. The same problem can be observed for Admin account.

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

I can clone the repo correctly when non-absolute path is used (shunit02, or even ../tmp/shunit02).

使用:


  • Windows 7 Enterprise版本6.1 Build 7601 Service Pack 1

  • git 2.5.1.windows.1

  • cygwin 2.3.1-1

编辑

/ tmp 目录被视为 C:\cygwin64\tmp 通过窗口。我使用 / tmp 为例,事实上在 / cygdrive / c 中也是如此。

The /tmp directory is seen as C:\cygwin64\tmp by windows. I used /tmp as an example, the same happens in /cygdrive/c in fact.

编辑2:

我使用Git for Windows。克隆工作时使用widows路径为目标像: git clone https://github.com/zandev/shunit2.git'C:\cygwin64\tmp\shunit4'

I am using Git for Windows. The clone works when using widows path for target like: git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'

推荐答案

这是由 Git for Windows 不接受cygwin路径,因此 / a / b / c 已转换为 c:\a\b\c 。实际上,这就是克隆存储库的地方,它解释了后续克隆尝试失败的原因。

This is caused by Git for Windows not accepting cygwin paths, therefore /a/b/c got translated to c:\a\b\c. In fact, that is where the repositories are cloned and it explain why subsequent clone attempts fail. The directory in fact exists, though the real destination is unexpected.


  • 使用 Git for Windows 附带的bash和其路径约定

  • 使用接受cygwin路径的cygwin git(据说可能还有其他问题) ,

  • 使用本机Windows路径: git clone https://github.com/zandev/shunit2.git'C:\cygwin64\tmp\shunit4 '

  • 使用相对目标名称,因为它似乎工作没有问题。

  • Use bash shipped with Git for Windows and their path conventions,
  • Use cygwin git that accept cygwin paths (reportedly, there might be other problems),
  • Use native windows paths: git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4',
  • Use relative target names as it seems to work without problems.

这篇关于本地Git存储库不存在从成功克隆从cygwin bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆