您的当前位置:首页>全部文章>文章详情

在非空目录下git克隆项目方法

发表于:2023-04-14 15:54:21浏览:712次TAG: #克隆 #非空目录

在非空目录下 git clone 项目时会提示错误信息:

fatal: destination path '.' already exists and is not an empty directory.

解决办法:

1. 进入非空目录,假设是 /dir/jk1

2. git clone --no-checkout https://git.oschina.net/jankerli/test.git tmp

3. mv tmp/.git .   

4. rmdir tmp

5. git reset --hard HEAD