Search code examples
gitgithuberror-handlinggit-clone

Why does git not allow me to clone this repository?


Git gives me this when I attempt to clone.

$ git clone --depth 1 "https://github.com/Ajatt-Tools/kitsunekko-mirror.git"
Cloning into 'kitsunekko-mirror'...
remote: Enumerating objects: 101147, done.
remote: Counting objects: 100% (101147/101147), done.
remote: Compressing objects: 100% (94534/94534), done.
remote: Total 101147 (delta 6117), reused 100653 (delta 5991), pack-reused 0
Receiving objects: 100% (101147/101147), 1.11 GiB | 20.19 MiB/s, done.
Resolving deltas: 100% (6117/6117), done.
fatal: cannot create directory at 'subtitles/16bit Sensation: Another Layer': Invalid argument
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

After doing git status it gives me fatal: not a git repository (or any of the parent directories): .git

I tried changing a bunch of config settings like git config --system core.longpaths true or installing GIT-LFS. I also tried git config --global core.protectNTFS false but that didn't work either. Git version 2.45.0.windows.1


Solution

  • Clone succeeded, but checkout failed.

    As git told you, git successfully cloned the repository

    But it fails at populating the working directory i.e. checkout.

    The reason:

    fatal: cannot create directory at 'subtitles/16bit Sensation: Another Layer'

    Git can't create the folder because it contains a : which is not allowed in a folder name on Windows

    forbidden characters

    To be able to checkout, files, you should set this git settings:

    git config --global core.protectNTFS false
    

    More details in this answer: https://stackoverflow.com/a/70090792/717372

    Or you could use git sparse-checkout feature to exclude this folder from checkout: https://stackoverflow.com/a/26129711/717372