克隆项目报错git clone - error: invalid path

克隆项目报错问题 :error: invalid path 'Debugging-system:-ideas-on-how-to-improve-the-debugging-system.mediawiki'

这个库在远端服务器已经clone成功了, 这个文件可以浏览, 内容正常.
修改配置如下
关掉NTFS下的路径保护机制,防止文件系统出错,这样就不存在找不到文件路径了
git config --global core.protectNTFS false

还有一个换行转换的配置

git config --global core.autocrlf false

配置大意:

core.protectNTFS

core.protectNTFS
If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict with 8.3 "short" names. Defaults to true on Windows, and false elsewhere.


core.protectNTFS 如果为true, 不允许迁出可能不符合NTFS系统路径的文件. 所以要设置为false, 原样从库里迁出.
因为windows中是可以设置文件有超长路径的, 这个也不应该由git迁出来考虑.

core.autocrlf

core.autocrlf
Setting this variable to "true" is the same as setting the text attribute to "auto" on all files and core.eol to "crlf". Set to true if you want to have CRLF line endings in your working directory and the repository has LF line endings. This variable can be set to input, in which case no output conversion is performed.


core.autocrlf 如果为true, 会将文件中的文本行的结尾’\0’换位"\r\n"
这个设置为false, 可以保证原样迁出, 不修改迁出的文件格式.

原因: windows与linux系统不兼容导致

git 仓库 里面有 windows 无法命名的文件名,一般是在出现 特殊符号 时会出现。 比如说 : 、 / 、 ? 空格等这类特殊字符。

导致文件名或文件夹名称不支持

可以在远端的git服务器, 将这个不符合windows文件格式的文件改名,重新在本地迁出整个项目, 迁出成功了.

远端文件改名后,可能会引起迁出后的文件引用关系出错. 当出错时, 就引用自己改名后的这个文件.

(系统之间文件名兼容性)


如果要考虑不同OS之间文件名的兼容性, 文件命名规则最好如下:

最好只使用英文字母(大小写可以混合), 不要使用中文或者其他英文符号.
如果要连接不同的词组描述, 最好使用’_’
文件名称长度, 尽量短一些

详看git官方(https://git-scm.com/docs/git-config)

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值