简体   繁体   中英

git clone error under Windows with symlinks

I get "warning: the following paths have collided (eg case-sensitive paths on a case-insensitive filesystem) and only one from the same colliding group is in the working tree" error, when using git clone:

git clone -c core.symlinks=true ssh://root@11.22.33.44/etc c/Dev/GIT/mysite-etckeeper/
Cloning into 'c/Dev/GIT/mysite-etckeeper'...
remote: Counting objects: 1400, done.
remote: Compressing objects: 100% (1202/1202), done.
remote: Total 1400 (delta 195), reused 0 (delta 0)
Receiving objects: 100% (1400/1400), 3.71 MiB | 276.00 KiB/s, done.
Resolving deltas: 100% (195/195), done.
Checking out files: 100% (1154/1154), done.
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:

  'HOSTNAME'
  'hostname'


/etc # ls -la HOSTNAME
lrwxrwxrwx   1 root root         8 Mar 29  2017 HOSTNAME -> hostname

/etc # ls -la hostname
-rw-r--r--   1 root root        18 Dec 21  2016 hostname

How can I fix this problem? This symlink issue is causing other problems, too.

EXAMPLE: Here is an the example repo to reproduce the error: https://github.com/klorinczi/test_dupe_filename

Execute this:

$ git clone -c core.symlinks=true https://github.com/klorinczi/test_dupe_filename 
Cloning into 'test_dupe_filename_example'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 9 (delta 0), reused 9 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
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:

  'HOSTNAME'
  'hostname'

You're on a system with a case-insensitive file system, and the repository contains two files that differ only in case ( HOSTNAME and hostname ). There is no way to represent both of these files on the system at the same time, and so only one file is checked out. (Note that this has nothing to do with your use of symlinks.)

You have some choices:

  • You can ask the maintainer of that repository to remove one of the duplicate files, renaming it;
  • If you're on Windows 10, you can make your Git repository case sensitive after you've created it with git init , and then use git fetch in the existing repository to pull in the data, instead of cloning it;
  • You can continue to live with it like it is; or
  • You can use a different operating system, such as Linux, possibly in a VM.

If you want to pick the second option, you'd do something like the following:

git init mysite-etckeeper
# Steps to make mysite-etckeeper case-sensitive from link above.
cd mysite-etckeeper
git remote add origin ssh://root@11.22.33.44/etc
git fetch origin
git reset --hard origin/master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM