Git:warning: Clone succeeded, but checkout failed.

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:

  1. File path/name conflicts --- filenames with characters invalid on your OS (e.g., :, *, ?, " on Windows), or case-insensitive filesystem collisions (e.g., Readme.md vs README.md on macOS/Windows)
  2. Permissions issue --- Git can't write certain files to disk
  3. Long file paths --- common on Windows where paths are limited to 260 characters by default
  4. 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

相关推荐
鬼手点金9 小时前
Agent 的学习机制:后训练、上下文学习与外部化学习
java·人工智能·git·学习·自动化·nanogpt
金融小师妹14 小时前
多因子时间序列分析:美元与美债收益率变化对黄金价格+1.6%的影响
c语言·人工智能·git·决策树·pyqt
AOI小白新手上路15 小时前
autodl无卡模式下载NTURain 训练集实录:基于 Git 部分克隆与稀疏检出的数据拉取
大数据·git·elasticsearch
天府云创15 小时前
Anthropic重做Git:Scion——Agent时代的版本管理系统
git·svn·版本控制·软件设计·迭代升级·scion
wflynn19 小时前
GitHub 今日推荐|open_scion:为AI代理设计的并发版本控制
git·开源·go·github·agent·coding-agents
初願致夕霞19 小时前
Git 指南
大数据·git·elasticsearch
爱喝热水的呀哈喽1 天前
cxmt research
git
爱喝热水的呀哈喽1 天前
概论research
git
鶴哥只手遮天1 天前
Gitea源码深度剖析-第6章 Git 底层封装与仓库存储
git·开源
鶴哥只手遮天1 天前
Gitea源码深度剖析-第2章 启动流程与配置体系
git·开源