从 cygwin bash 成功克隆后,本地 Git 存储库不存在
Local Git repository does not exist after successful clone from cygwin bash
当我克隆到通过绝对路径引用的目录(不存在)时,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
)时,我可以正确克隆 repo。
使用:
- Windows 7 Enterprise Ver 6.1 Build 7601 Service Pack 1
- git 2.5.1.windows.1
- cygwin 2.3.1-1
编辑:
/tmp
目录被 windows 视为 C:\cygwin64\tmp
。我以 /tmp
为例,实际上 /cygdrive/c
也是如此。
编辑 2:
我正在为 Windows 使用 Git。克隆在使用 widows 路径作为目标时有效,例如:git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
您能否尝试重命名现有 /tmp
并重新创建它 在 cygwin 安装文件夹 中,如 http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#tmpfiles 中所述:
建议 1
Q: After I installed cygwin, and I started it it gives the
following messages: bash.exe: warning: could not find /tmp, please
create! bash: /etc/profile: Invalid argument bash: /.bash_profile:
Invalid argument
A: You need to first create the directory /tmp. Assuming your
cygwin root directory is called C:/cygwin, that means you should
first create the directory C:/cygwin/tmp.
建议 2
您似乎正在为 Cygwin 中的 Windows' git 可执行文件使用 Git Bash。可能值得尝试使用 Cygwin 本身提供的 git 可执行文件。
这是由 Git 引起的 Windows not accepting cygwin paths,因此 /a/b/c
被翻译成 c:\a\b\c
.事实上,那是存储库被克隆的地方,它解释了为什么后续的克隆尝试失败。该目录实际上存在,尽管真正的目的地是意外的。
什么会起作用?
- 使用 Git 附带的 bash 用于 Windows 及其路径约定,
- 使用接受 cygwin 路径的 cygwin git(据报道,可能还有其他问题),
- 使用本机 windows 路径:
git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
、
- 使用相对目标名称,因为它看起来没有问题。
当我克隆到通过绝对路径引用的目录(不存在)时,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
)时,我可以正确克隆 repo。
使用:
- Windows 7 Enterprise Ver 6.1 Build 7601 Service Pack 1
- git 2.5.1.windows.1
- cygwin 2.3.1-1
编辑:
/tmp
目录被 windows 视为 C:\cygwin64\tmp
。我以 /tmp
为例,实际上 /cygdrive/c
也是如此。
编辑 2:
我正在为 Windows 使用 Git。克隆在使用 widows 路径作为目标时有效,例如:git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
您能否尝试重命名现有 /tmp
并重新创建它 在 cygwin 安装文件夹 中,如 http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#tmpfiles 中所述:
建议 1
Q: After I installed cygwin, and I started it it gives the following messages: bash.exe: warning: could not find /tmp, please create! bash: /etc/profile: Invalid argument bash: /.bash_profile: Invalid argument
A: You need to first create the directory /tmp. Assuming your cygwin root directory is called C:/cygwin, that means you should first create the directory C:/cygwin/tmp.
建议 2
您似乎正在为 Cygwin 中的 Windows' git 可执行文件使用 Git Bash。可能值得尝试使用 Cygwin 本身提供的 git 可执行文件。
这是由 Git 引起的 Windows not accepting cygwin paths,因此 /a/b/c
被翻译成 c:\a\b\c
.事实上,那是存储库被克隆的地方,它解释了为什么后续的克隆尝试失败。该目录实际上存在,尽管真正的目的地是意外的。
什么会起作用?
- 使用 Git 附带的 bash 用于 Windows 及其路径约定,
- 使用接受 cygwin 路径的 cygwin git(据报道,可能还有其他问题),
- 使用本机 windows 路径:
git clone https://github.com/zandev/shunit2.git 'C:\cygwin64\tmp\shunit4'
、 - 使用相对目标名称,因为它看起来没有问题。