How to run bash script after git push How to run bash script after git push bash bash

How to run bash script after git push


This is fairly easy. There is a script ready to run. You will have to modify .git/hooks/post-commit to find the script you need to run.

mv .git/hooks/post-commit.sample .git/hooks/post-commitvim .git/hooks/post-commit

I found this at: git-scm.com: Git Hooks

If there is no .git/hooks/post-commit.sample file, not a problem, just create .git/hooks/post-commit from scratch (Remember to make the script executable with chmod +x), for example:

#!/bin/shecho look at me I am the post-commit scriptpwd# call the script you want

Do a test commit and you should see the output of the script, right before the regular output of the commit.