我在做:

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

我得到:

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

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

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


当前回答

Do

git clone https://user@bitbucket.org/user/projectname.git .

目录必须为空

其他回答

以下内容可能并不完全等同于克隆游戏,但对我来说却很管用:

git init .
git remote add -t \* -f origin <repository-url>
git checkout master

在我的例子中,这将生成一个.git/config文件,该文件与我在进行克隆时得到的文件相同。

为了确保你可以克隆这个repo,转到任何临时目录并在那里克隆项目:

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

这将把你的东西克隆到project_hub目录中。

一旦克隆完成,你可以把这个目录移动到任何你想要的地方:

mv project_hub /path/to/new/location

这是安全的,不需要任何神奇的东西。

@Andrew已经清楚地回答了这个问题。但是,即使目录不是空的,也可以像这样简单:

git init .
git remote add origin <repository-url>
git pull origin master

所以我通过删除根目录中隐藏的.git文件夹,然后在根/dist文件夹中的'git clone repo .'中添加句点来修复这个相同的错误。这是vue-cli webpack项目的上下文。所以其他人说的都是对的,这通常意味着你在你想要克隆的文件夹或父文件夹或根文件夹中有git跟踪!

git clone ssh://user@host.com/home/user/private/repos/project_hub.git $(pwd)