当我执行 git clone 时,在不区分大小写的文件系统上出现区分大小写的路径冲突 [英] Case-sensitive path collisions on case-insensitive file system when I do git clone

查看:38
本文介绍了当我执行 git clone 时,在不区分大小写的文件系统上出现区分大小写的路径冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我 git clone 存储库时,会出现以下警告:

when I git clone the repository the following warning appears:

...
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'components/User/index.js'
  'components/user/index.js'

我一直在阅读,这可能是 Windows 问题,因为文件夹路径中未启用区分大小写.我也试过 git config --global core.ignorecase false 但它一直失败.

I've been reading and it may be a windows problem since case sensitive is not enabled in the folder paths. I also tried with git config --global core.ignorecase false but it keeps failing.

所有不区分大小写的文件系统都面临这个问题,即 Windows 10(NTFS) 和 macOS(APFS).

This problem is faced with all case-insensitive file systems, i.e Windows 10(NTFS) and macOS(APFS).

有人也看到这个问题吗?

Does anyone also see this problem?

推荐答案

定义

  • 区分大小写文件系统:将 john.jpgJOHN.jpg 视为两个不同的文件是允许的.
  • 不区分大小写文件系统:将 john.jpgJOHN.jpg 视为同一个文件这是允许的.
  • Definitions

    • case-sensitive filesystem: treats john.jpg and JOHN.jpg as two different files and this is allowed.
    • case-insensitive filesystem: treats john.jpg and JOHN.jpg as one and the same file which is not allowed.
    • 'components/User/index.js'
      'components/user/index.js'
      

      这里的问题是 Useruser 不允许在一个案例的 components 目录内同时共存- 不敏感文件系统(如果您使用的是 Windows 10,则为 NTFS).

      The problem here is that User and user are not allowed to co-exist at the same time inside the components directory on a case-insensitive filesystem (which is NTFS if you're using Windows 10).

      如果您最近克隆了 repo 并且尚未对其进行任何工作,我建议您重新开始.因此,删除克隆,然后为您打算克隆存储库的目录启用区分大小写,然后重新克隆它.在克隆过程之前这样做的好处是,由 git 作为克隆过程的一部分创建的所有目录都将区分大小写,并且 git 将不再给出此警告.此外,它还可以让您收拾残局.

      If you have recently cloned the repo and have not done any work on it yet, I recommend that you start over. So remove the clone, then enable case-sensitivity for the directory you intend to clone your repo in, and then clone it anew. The benefit of doing this ahead of the cloning process is that all directories that are created as part of the cloning process by git will be case-sensitive and git will no longer give this warning. Plus, it enables you to clean up the mess.

      1. 以管理员身份打开命令提示符.
      2. 转到您打算克隆存储库的目录.在本例中,我将使用 C:UsersJuanDesktop.你不必cd到这个目录来做下一步,只要知道你的目标目录是什么.
      3. 为目标目录启用区分大小写.命令:fsutil.exe 文件 SetCaseSensitiveInfo "C:UsersJuanDesktop"启用
      4. 克隆您的代码库.在这个例子中,我将使用 https://github.com/torvalds/linux.git.命令:git clone https://github.com/torvalds/linux.git
      5. (可选):删除或重命名冲突的文件和文件夹(如果它们相同).您需要通过比较它们来验证这一点.要删除,请使用 git rm,要移动或复制,请使用 git mv.
      6. (可选):如果您具有写入权限(并且可能在与团队其他成员讨论问题之后),则提交您的更改并将其推送到上游存储库.
      7. (可选):禁用区分大小写.命令:fsutil.exe 文件 SetCaseSensitiveInfo "C:UsersJuanDesktop"禁用
      1. Open a command prompt as an administrator.
      2. Go to the directory where you intend to clone your repo. In this example I will use C:UsersJuanDesktop. You don't have to cd to this directory to do the next step, just know what your target directory is.
      3. Enable case-sensitivity for the target directory. Command: fsutil.exe file SetCaseSensitiveInfo "C:UsersJuanDesktop" enable
      4. Clone your repo. In this example I will use https://github.com/torvalds/linux.git. Command: git clone https://github.com/torvalds/linux.git
      5. (optional): Remove or rename conflicting files and folders if they are the same. You need to verify this by comparing them. To remove, use git rm and to move or copy, use git mv.
      6. (optional): Commit and push up your changes to the upstream repo if you have write permission (and possibly after discussing the problem with the rest of the team).
      7. (optional): Disable case-sensitivity. Command: fsutil.exe file SetCaseSensitiveInfo "C:UsersJuanDesktop" disable

      现在您可以继续处理该项目了.

      Now you can go back to working on the project.

      来源:Windows Central

      在 macOS 上,您必须将宗卷重新格式化为不区分大小写/区分大小写,或者完全创建一个新宗卷.详情

      On macOS, you will have to reformat volume as case-insensitive/sensitive or make a new volume altogether. Details

      您可能遇到了这个问题,因为您克隆了在运行 Linux 或 Mac 的计算机上创建的存储库,它可能是由其他人创建的,而不是您个人创建的.这里的教训是始终与您命名事物的方式保持一致,这适用于参与项目的每个人.这是其他情况下可能发生的情况的一个示例.

      You probably ran into this problem because you cloned a repo that was created on a computer that runs Linux or Mac, perhaps it was created by someone else and not you personally. The lesson here is to always be consistent with the way you name things, and this applies to everyone involved in a project. This is one example of what can happen otherwise.

      这篇关于当我执行 git clone 时,在不区分大小写的文件系统上出现区分大小写的路径冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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