命令git clonegit@github.com:whatever创建一个名为whatever的目录,其中包含Git存储库:

./
    whatever/
        .git

我希望将Git存储库的内容克隆到我的当前目录中。/而是:

./
    .git

当前回答

您可以使用以下git命令使用自定义目录名进行克隆

git clone <git_repo_url> <your_custom_directory_name>

注意:您不需要创建自定义目录,因为它会自动创建

其他回答

选项A:

git clone git@github.com:whatever folder-name

Ergo,在这里使用:

git clone git@github.com:whatever .

选项B:

也移动.git文件夹。请注意,.git文件夹在大多数图形文件浏览器中都是隐藏的,所以一定要显示隐藏的文件。

mv /where/it/is/right/now/* /where/I/want/it/
mv /where/it/is/right/now/.* /where/I/want/it/

第一行获取所有普通文件,第二行获取点文件。也可以通过启用dotglob(即shopt-s dotglob)在一行中完成,但如果你问这个答案所回答的问题,这可能是一个糟糕的解决方案。

更好:

将工作副本保存在其他地方,并创建一个符号链接。这样地:

ln -s /where/it/is/right/now /the/path/I/want/to/use

对于您的情况,这可能是:

ln -sfn /opt/projectA/prod/public /httpdocs/public

如果您需要,可以很容易地将其更改为测试,即:

ln -sfn /opt/projectA/test/public /httpdocs/public

而无需四处移动文件。添加了-fn,以防有人复制这些行(-f是强制的,-n避免与现有和非现有链接进行一些经常不需要的交互)。

如果你只是想让它发挥作用,使用选项A,如果其他人要看你做了什么,使用选项C。

要克隆到当前工作目录:

git clone https://github.com/link.git

要克隆到另一个目录:

git clone https://github.com/link.git ./Folder1/Folder2

希望它有帮助:)

如果要将其签入当前目录,请确保删除.git存储库。

rm-rf.git然后是git克隆https://github.com/symfony/symfony-sandbox.git

您可以使用以下git命令使用自定义目录名进行克隆

git clone <git_repo_url> <your_custom_directory_name>

注意:您不需要创建自定义目录,因为它会自动创建

For Windows user 

1> Open command prompt.
2> Change the directory to destination folder (Where you want to store your project in local machine.)
3> Now go to project setting online(From where you want to clone)
4> Click on clone, and copy the clone command.
5> Now enter the same on cmd .

It will start cloning saving on the selected folder you given .