要将git存储库克隆到特定文件夹中,可以使用
-C <path>
参数,例如
git -C /httpdocs clone git@github.com:whatever
尽管它仍然会创造
whatever
文件夹,以便将存储库的内容克隆到当前目录中,请使用以下语法:
cd /httpdocs
git clone git@github.com:whatever .
请注意,克隆到现有目录是
只有
当目录为
空的
.
由于要克隆到可供公众访问的文件夹中,请考虑使用
--separate-git-dir=<git dir>
或排除
.git
Web服务器配置中的文件夹(例如
.htaccess
文件)。