Git hook setup for Tweet my commits
Twurl can be installed using ruby gems:
gem install twurlIf you haven't already, the first thing to do is apply for a developer account to access Twitter APIs:
https://developer.twitter.com/en/apply-for-access
After you have that access you can create a Twitter app and generate a consumer key and secret.
Just copy the consumer key and secret in the .bashrc file.
open the .bashrc file:
vim ~/.bashrccopy the consumer key and secret:
export TWITTER_CONSUMER_KEY=your_consumer_key_here
export TWITTER_CONSUMER_SECRET=your_consumer_secret_herereload env variables:
source ~/.bashrcexecute the pre-authorize script:
sh pre-authorize.shThis will return an URL that you should open up in your browser. Authenticate to Twitter, and then enter the returned PIN back into the terminal. Assuming all that works well, you will be authorized to make requests with the API. Twurl will tell you as much.
Now just copy the post-commit script and paste itinto .git/hook/ of any project.
cp post-commit ~/my-awesome-git-project/.git/hooks/post-commit