git checkout错误:无法创建文件 [英] git checkout error: unable to create file

查看:1698
本文介绍了git checkout错误:无法创建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




$ git将git git存储库从Linux克隆到Windows系统时,出现以下错误:克隆gituser @serveraddr:/git/git_repo.git git_WA

克隆到'git_WA'...

gituser @serveraddr的密码:

remote:计数对象:500846,完成。

remote:压缩对象:100%(118676/118676)完成。

remote:总计500846(delta 307739),重用483023(delta 291136)<
接收对象:100%(500846/500846),907.54 MiB | 9.04 MiB / s,完成。

解析三角洲:100%(307739/307739),完成。

错误:无法创建文件RealR **************************** ************************************************** ************************************************** ************************************************** **************************** validation.xml(没有这样的文件或目录)

检出文件:100 %(441329/441329)

检出文件:100%(441329/441329)完成。

完成。


案例2:克隆为裸回购,全部从裸回购本地检出=>同样的错误。



案例3:在C:\中直接复制回购,结帐成功,没有错误。



- >这看起来像是文件名/文件路径长度限制的问题。案例-4:从SVN回购中检出相同的文件。能够在任何地点结账,没有任何问题。因此从Windows端没有问题。 (是的,我在SVN和GIT中都有数据,我只是从SVN迁移到GIT)。

因此,问题必须在msysgit中,某些文件路径长度限制。可以调整gitclient / msysgit中的路径长度吗?



Edit1:所有操作均使用 TortoiseGIT客户端v1.8.0 git-bash:git 1.8.0版进行尝试。 msysgit.0

Edit2:添加了克隆时使用的实际命令。

解决方案

在将项目签出到具有67-(Windows)或76-(cygwin)字符基本路径的Windows目录中时,遇到类似问题 - 将其添加到签出文件的路径长度时,超出Windows的路径长度限制:

  git checkout -f HEAD 
错误:无法创建文件< 194-字符文件路径> (没有这样的文件或目录)
fatal:无法在'< 187-字符目录路径>'创建目录:没有这样的文件
或目录
pre>

我通过签出c:\ git解决了这个问题,它的长度为6或15个字符,在Windows限制下保持最大路径长度。


While cloning a git repository from Linux to a Windows system, I am getting the following error in checkout the phase:

$ git clone gituser@serveraddr:/git/git_repo.git git_WA
Cloning into 'git_WA'...
gituser@serveraddr's password:
remote: Counting objects: 500846, done.
remote: Compressing objects: 100% (118676/118676), done.
remote: Total 500846 (delta 307739), reused 483023 (delta 291136)
Receiving objects: 100% (500846/500846), 907.54 MiB | 9.04 MiB/s, done.
Resolving deltas: 100% (307739/307739), done.

error: unable to create file RealR**************************************************************************************************************************************************************************************************************validation.xml (No such file or directory)
Checking out files: 100% (441329/441329)
Checking out files: 100% (441329/441329), done.
done.

Case-2: Cloned as bare repo, checked-out all from bare repo locally => Same error.

Case-3: Clone the repo in C:\ directly, checkout successful, No error.

-> It looks like problem with filename/filepath length limitation.

Case-4: checkout the same files from SVN repo. Able to checkout at any location without any problem. Hence no problem from windows side. (Yes, l have data in SVN and GIT both, I just migrated from SVN to GIT).

Hence, the problem has to be within msysgit, some filepath length limitation. Can path length in gitclient/msysgit be tweaked?

Edit1: All operation tried with TortoiseGIT client v1.8.0 and git-bash: git version 1.8.0.msysgit.0.
Edit2: Added the actual command used while cloning.

解决方案

I experienced similar problems when checking out a project into a Windows directory that had a 67- (Windows) or 76- (cygwin) character base path - when added to the path-length of the checked out files, it exceeded Windows' path-length limit:

git checkout -f HEAD
error: unable to create file <194-character filepath> (No such file or directory)
fatal: cannot create directory at '<187-character directory path>': No such file
or directory

I solved the problem by checking out to c:\git, which, at 6 or 15 characters in length, kept the maximum path-length under the Windows limit.

这篇关于git checkout错误:无法创建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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