我在做:

git clone ssh://user@host.com/home/user/private/repos/project_hub.git ./

我得到:

致命:目标路径'。’已经存在,不是空的 目录中。

我知道路。已经存在。 我可以保证这个目录是空的。(我在里面,我什么都看不到!)

为了将该项目克隆到当前目录,我在这里遗漏了什么?


当前回答

使用。在你命令的最后,像下面这样

git clone URL .

其他回答

通过mkdir filename创建一个新的项目目录,然后运行git clone xxxxx命令,并移动文件,这是很有用的

如果当前目录是空的,那么这将工作:

git clone <repository> foo; mv foo/* foo/.git* .; rmdir foo
git clone ssh://user@host.com/home/user/private/repos/project_hub.git $(pwd)

除了@StephaneDelcroix的回答,在使用之前:

git clone git@github.com.user/my-project.git .

通过使用,确保当前目录为空

ls -a

只要在旁边加个点就可以了

git clone git@github.com:user/my-project.git .

从git帮助克隆:

仅当现有目录为空时才允许克隆到该目录。

因此,确保目录为空(使用ls -a检查),否则命令将失败。