简体   繁体   English

自动将本地Github存储库与服务器上的目录同步

[英]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 push git post-hook to Github. 您可以将git post-hook推送到Github。 Instead, you can use Github's Webhooks 相反,您可以使用Github的Webhooks

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.

相关问题 Cordova与服务器的本地存储同步 - Cordova Local Storage Sync with Server 为什么我的本地项目没有被推送到 github 存储库? - Why is my local project not being pushed to github repository? 尝试回购 Github 存储库,但错误显示错误:ENOENT:没有这样的文件或目录 - Trying Repo Github repository, but error showing Error: ENOENT: no such file or directory 如何执行github存储库的自动克隆,应该使用节点js自动将该存储库复制到一个文件夹中? - How to perform automatic cloning of github repository and that repository should be copied in one folder automatically using node js..? 从 github 下载源代码到我的本地服务器 - download the source code from github to my local server 如何使用 Github API 从存储库中的目录获取文件名 - How do I get file names from a directory in a repository using Github API 在 Heroku 中签出 GitHub 存储库 - Checkout a GitHub repository in Heroku 如何扫描GitHub存储库? - How to scan GitHub repository? github非常令人烦恼的条件或找不到本地存储库目录并且无法编辑文件 - github very irritating condition or not finding local repo directory and not able to edit files AZURE Web应用程序:从Github存储库部署Angular SPA和Node Express服务器 - AZURE Web Apps: deploying Angular SPA & Node Express server from Github repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM