更新时间:2022-01-01 08:13:51
您可以使用后收到钩做了 git的拉
你的 Web服务器
文档根目录/存储库。
You can use a post-receive hook to do a git pull
inside your webserver
document root/repository.
在你的裸库
做
in your bare repository do
mv hooks/post-receive.sample hooks/post-receive
chmod +x .git/hooks/post-receive
后收到的应该是类似
the post receive should be something like
#!/bin/sh
WEB_ROOT='/var/www/project'
cd $WEB_ROOT
git pull
一个更优雅的解决方案不涉及Web服务器区域是一个Git仓库,你也可以查看有关挂钩
A more elegant solution that doesn't involve that the web server area being a git repository, you can also review the git documentation about hooks
注:如果您使用简单的解决方案,请确保您的网络服务器不符合的.git目录,这将给一些黑客/饼干访问该网站源$ C $ C ! STRONG>
Note: if you use the simple solution, please make sure that your webserver doesn't serve the .git directory, this would give some hackers/crackers the access to the website source code!