I am trying to set up a system where, when I commit changes to my GitHub repository, my server also receives those commits.
To do that, I set my GitHub repo to send a post-receive hook to a URL on my rails app. I have a controller that will handle this.
The problem is this: how can I run git commands in a rails controller? I get how to do it in the command line.
Do I just type something like this:
# controller method where post-receive hook is sent
def commit
git pull origin development
end
See Question&Answers more detail:os