git clone到非空目录

问题描述

如果我们往一个非空的目录下 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

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

参考

参考:如何 clone git 项目到一个非空目录

posted @ 2015-01-25 20:39  kaiyuan_ky  阅读(551)  评论(0编辑  收藏  举报