git 报错 destination path already exists and is not empty director

git 报错 destination path already exists and is not empty director

既然报错 必然存在报错的机制

报错机制
git 报错 destination path already exists and is not empty director

桌面上创建任意文件夹

拉取任意 git 项目
git 报错 destination path already exists and is not empty director
再执行一次
git 报错 destination path already exists and is not empty director

报错出现了

存在同名目录时将会报错

注意 重点来了

git 报错 destination path already exists and is not empty director

文件夹为空为啥也报错了

解决方案

git 报错 destination path already exists and is not empty director
git 报错 destination path already exists and is not empty director
把 隐藏的项目给勾上
git 报错 destination path already exists and is not empty director

git 报错 destination path already exists and is not empty director

你就会发现居然存在一个名叫 test 的隐藏文件夹

改名

git 报错 destination path already exists and is not empty director

拉取项目
git 报错 destination path already exists and is not empty director

就不报错啦

所以报错的根本原因就是存在同名的文件目录