如果我们往一个非空的目录下 clone git 项目,就会提示错误信息:

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

解决的办法是:

1. 进入非空目录,假设是 /workdir/proj1

2. git clone --no-checkout https://git.oschina.net/NextApp/platform.git tmp

3. mv tmp/.git .   #将 tmp 目录下的 .git 目录移到当前目录

4. rmdir tmp

5. git reset --hard HEAD

然后就可以进行各种正常操作了。

相关文章:

  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-01-12
  • 2021-09-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2021-08-26
  • 2022-12-23
  • 2021-11-11
相关资源
相似解决方案