Set Up Git
First, navigate to
cd && git init .
Set Up The Repository
You might already have your project hosted on GitHub or BitBucket. That's cool, because we can just leave it there. What we're about to do is add an endpoint, or another remote origin for your repository to be pushed to.
cd && git init --bare
Set Up Hooks
This is the most important part. GitHooks enable you to run scripts before and after your project is pushed. If you're feeling fancy, you can run scripts during. This generator is to aid in that.
You will enter a text editor to make changes to post-receive
#!/bin/bash if git --work-tree= --git-dir= checkout -f then echo "\nSUCCESS! Your project has uploaded\n" exit 1 else echo "\nSomething has gone wrong. Please resolve the issue and try again\n" fi
Press ctrl+x to exit
Make it runnable
You need to make this script executable. It's bash based, but I might add a fancier Python option in the future.
chmod +x /hooks/post-receive