Git Clone: Checkout Failed Warning
This warning means the repository was downloaded successfully , but Git couldn't check out (write) all the files to your working directory. The .git folder and history are intact --- only the working tree has issues.
Common causes:
- File path/name conflicts --- filenames with characters invalid on your OS (e.g.,
:,*,?,"on Windows), or case-insensitive filesystem collisions (e.g.,Readme.mdvsREADME.mdon macOS/Windows) - Permissions issue --- Git can't write certain files to disk
- Long file paths --- common on Windows where paths are limited to 260 characters by default
- Symlink issues --- the repo contains symlinks your OS can't create
Step 1: Diagnose the problem
bash
cd your-repo
git status
This shows which files failed to check out.
Step 2: Try common fixes
For Windows long path issues:
bash
git config --global core.longpaths true
git restore --source=HEAD :/
For Windows filename/case issues:
bash
git config --global core.protectNTFS false
git restore --source=HEAD :/
For permission issues:
Run your terminal as Administrator (Windows) or use sudo (Linux/Mac), then retry:
bash
git restore --source=HEAD :/
For symlink issues:
bash
git config --global core.symlinks false
git restore --source=HEAD :/
Step 3: If all else fails, clone with a sparse checkout to skip problematic files:
bash
git clone --no-checkout <repo-url>
cd your-repo
git sparse-checkout init
git checkout