0

I have a service where users can 'deploy' data, but right now they have to manually execute the deployment once they make updates. I would like to do it automatically when they push to a remote git repo that this service has access to. Lets say the user has done the following in their local repo:

git remote add AutoUpdater <whatever the URL is>

Then they make whatever updates to their local stuff, and push their commit to this remote repo:

git add .
git commit -m "version x.x.x"
git push AutoUpdater master

How can I check this AutoUpdater repo to see when users have pushed changes and know when to take action? I would prefer to use C#, which means I'll probably end up using LibGit2Sharp.

wlyles
  • 2,236
  • 1
  • 20
  • 38
  • 1
    If I understand right, you are looking for a continuous integration platform. In that case, have you met [jenkins](https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins)? – pratZ Aug 08 '14 at 19:22

1 Answers1

1

git provides a series of hooks which are run at different stages of the push process on the receiving side. These can be executables of any kind and get information about what is being updated. This is the only way git provides for reacting to events.

You can see a description of the hooks via git help hooks, and at http://git-scm.com/docs/githooks . For reacting to updates, you'd likely want either the "post-update" or "post-receive" hooks, depending on how much data you'd like at once.

I would recommend this way above polling the reference list, which is what you'd have to resort to if you were to observe the repository from outside (via libgit2sharp or git or whatever else).

Carlos Martín Nieto
  • 5,207
  • 1
  • 15
  • 16
  • Unfortunately, this will be used with TFS Git, which doesn't seem to support hooks yet :( – wlyles Aug 11 '14 at 17:24
  • In that case you likely wouldn't want a Git hook anyway, but whatever hook/plugin mechanism TFS provides, which is bound to work much better on a Windows environment. – Carlos Martín Nieto Aug 11 '14 at 23:33