Git:从存储库自动拉? [英] Git: auto pull from repository?

查看:117
本文介绍了Git:从存储库自动拉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法设置git,以便它从远程回购监听更新,并会在任何情况发生变化时拉动?用例是我想使用git部署一个Web应用程序(所以我得到了部署的应用程序的版本控制),但是希望把Gitub上的中央git repo放在Web服务器上(Github的界面只是soooo不错) 。

Is there any way to set up git such that it listens for updates from a remote repo and will pull whenever something changes? The use case is I want to deploy a web app using git (so I get version control of the deployed application) but want to put the "central" git repo on Github rather than on the web server (Github's interface is just soooo nice).

有没有人得到这个工作? Heroku怎么做?我的Google-fu没有给我任何相关的结果。

Has anyone gotten this working? How does Heroku do it? My Google-fu is failing to give me any relevant results.

推荐答案

Git有钩子,可以执行的动作其他行为。你似乎寻找的是后接收钩。在github管理员中,您可以设置一个接收后的网址,每次有人推送您的回购时,都会被点击(有效载荷包含刚刚推送的数据)。

Git has "hooks", actions that can be executed after other actions. What you seem to be looking for is "post-receive hook". In the github admin, you can set up a post-receive url that will be hit (with a payload containing data about what was just pushed) everytime somebody pushes to your repo.

对于什么是值得的,我不认为自动拉动是一个好主意 - 如果错误被推到你的分支怎么办?我会使用像 capistrano (或等效的)这样的工具。

For what it's worth, I don't think auto-pull is a good idea -- what if something wrong was pushed to your branch ? I'd use a tool like capistrano (or an equivalent) for such things.

这篇关于Git:从存储库自动拉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆