命令git clonegit@github.com:whatever创建一个名为whatever的目录,其中包含Git存储库:
./
whatever/
.git
我希望将Git存储库的内容克隆到我的当前目录中。/而是:
./
.git
命令git clonegit@github.com:whatever创建一个名为whatever的目录,其中包含Git存储库:
./
whatever/
.git
我希望将Git存储库的内容克隆到我的当前目录中。/而是:
./
.git
当前回答
虽然上面的所有答案都很好,但我想提出一种新的方法,而不是在公共html目录中使用符号链接方法,正如公认答案中提出的BEST。您需要访问服务器虚拟主机配置。
它是关于配置直接指向存储库目录的web服务器的虚拟主机。在Apache中,您可以这样做:
DocumentRoot/var/www/html/website/your git repo
以下是虚拟主机文件的示例:
<VirtualHost *:443>
ServerName example.com
DocumentRoot /path/to/your-git-repo
...
...
...
...
</VirtualHost>
其他回答
我想很多人都想问这个问题的例子就是这个。如果您位于git存储库内容转储到的目录中,请运行:
git clone git@github.com:whatever .
结尾处的“.”将当前文件夹指定为签出文件夹。
用法
git clone <repository>
将位于<repository>的存储库克隆到本地计算机上。原始存储库可以位于本地文件系统上,也可以位于可通过HTTP或SSH访问的远程计算机上。
git clone <repo> <directory>
将位于<repository>的存储库克隆到本地计算机上名为<directory>的文件夹中。
来源:设置存储库
如果要将其签入当前目录,请确保删除.git存储库。
rm-rf.git然后是git克隆https://github.com/symfony/symfony-sandbox.git
克隆:
git clone git@jittre.unfuddle.com:jittre/name.git
克隆“特定分支”:
git clone -b [branch-name] git@jittre.unfuddle.com:jittre/name.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 .