[英]Automatically Sync Local Github Repository with Directory on Server
I have been attempting to use hooks to automatically pull the updated repo from github to my remote web server. 我一直在尝试使用挂钩将更新的存储库从github自动拉到我的远程Web服务器。 This is the code on the post-receive hook:
这是接收后挂钩上的代码:
cd /home/[my username]/document_root/[github repo name]/
git pull origin master
I expect this to run when there is a new commit from my development machine that syncs with the one on github, but it doesn't update the files inside of that repo directory. 我希望当我的开发机器上有一个新提交与github上的提交同步时,它会运行,但是它不会更新该repo目录中的文件。 Any help is appreciated, but I am new to using git and github in general.
感谢您的帮助,但是一般来说我是git和github的新手。
EDIT: I tried to follow this tutorial but it still doesn't work. 编辑:我试图按照本教程,但它仍然无法正常工作。 http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook/
http://ryanflorence.com/deploying-websites-with-a-tiny-git-hook/
you can customize a schedule with crontab. 您可以使用crontab定制时间表。 for example, crontab -e , and input 5 * * * snyc_git.sh
例如crontab -e,并输入5 * * * snyc_git.sh
Then it will snyc your respository. 然后它将检测您的存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.