当在Windows下克隆git repo时,我得到“错误:无法创build文件<文件> …(是一个目录)”

Z:\>git clone git://github.com/kennethreitz/httpbin.git Cloning into 'httpbin'... remote: Counting objects: 1073, done. remote: Compressing objects: 100% (401/401), done. remote: Total 1073 (delta 672), reused 1045 (delta 651) Receiving objects: 100% (1073/1073), 114.42 KiB | 128 KiB/s, done. Resolving deltas: 100% (672/672), done. error: unable to create file httpbin/templates/... (Is a directory) 

git版本1.8.0.msysgit.0,Windows Vista SP2 x64

怎么了?

我认为麻烦的是你在这里的这个文件回购: https : //github.com/kennethreitz/httpbin/blob/master/httpbin/templates/ …

...在Windows下不是有效的文件名

为了获得回购,克隆而不检出文件(带-n标志):

git clone -n git://repo

然后,您可以使用sparse-checkout获取所有文件,但是... ,或者只能git checkout您实际需要的git checkout文件。