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

./
    whatever/
        .git

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

./
    .git

当前回答

如果使用github-cli,则可以使用以下命令:

gh repo clone <repository> [<directory>] [-- <gitflags>...]

例如,您可以运行以下命令:

gh repo clone repository-name-on-github my-local-folder

其他回答

进入文件夹。。如果文件夹为空,则:

git clone git@github.com:whatever .

else

git init
git remote add origin PATH/TO/REPO
git fetch
git checkout -t origin/master

如果要克隆到当前文件夹,应尝试以下操作:

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

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

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

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

git clone <git_repo_url> <your_custom_directory_name>

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

用法

git clone <repository>

将位于<repository>的存储库克隆到本地计算机上。原始存储库可以位于本地文件系统上,也可以位于可通过HTTP或SSH访问的远程计算机上。

git clone <repo> <directory>

将位于<repository>的存储库克隆到本地计算机上名为<directory>的文件夹中。

来源:设置存储库