命令git clonegit@github.com:whatever创建一个名为whatever的目录,其中包含Git存储库:
./
whatever/
.git
我希望将Git存储库的内容克隆到我的当前目录中。/而是:
./
.git
命令git clonegit@github.com:whatever创建一个名为whatever的目录,其中包含Git存储库:
./
whatever/
.git
我希望将Git存储库的内容克隆到我的当前目录中。/而是:
./
.git
当前回答
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 .
其他回答
进入文件夹。。如果文件夹为空,则:
git clone git@github.com:whatever .
else
git init
git remote add origin PATH/TO/REPO
git fetch
git checkout -t origin/master
当您将文件移动到需要的位置时,是否也在移动.git目录?根据您的操作系统和配置,此目录可能被隐藏。
它包含repo和支持文件,而位于/public目录中的项目文件仅为当前签出提交(默认情况下为主分支)中的版本。
如果要将其签入当前目录,请确保删除.git存储库。
rm-rf.git然后是git克隆https://github.com/symfony/symfony-sandbox.git
用法
git clone <repository>
将位于<repository>的存储库克隆到本地计算机上。原始存储库可以位于本地文件系统上,也可以位于可通过HTTP或SSH访问的远程计算机上。
git clone <repo> <directory>
将位于<repository>的存储库克隆到本地计算机上名为<directory>的文件夹中。
来源:设置存储库
要将git存储库克隆到特定文件夹中,可以使用-C<path>参数,例如。
git -C /httpdocs clone git@github.com:whatever
尽管它仍然会在其上创建一个任意文件夹,但要将存储库的内容克隆到当前目录中,请使用以下语法:
cd /httpdocs
git clone git@github.com:whatever .
请注意,仅当目录为空时,才允许克隆到现有目录中。
由于要克隆到可供公众访问的文件夹中,请考虑使用--separate Git-dir=<Git-dir>或在web服务器配置中排除.Git文件夹(例如在.htaccess文件中),将Git存储库与工作树分离。