On the push side, you can use a local .git/hooks/post-commit
that includes:
#!/bin/sh
git push origin master
(assuming here you are pushing from master
: you have other options at "How to automatically push after committing in git?")
If you want a local repo always up-to-date with a remote GitHub repo, you can setup a webhook which will listen for push events and automatically pull for you.
See for instance this webhook (or this one):
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ($_SERVER['HTTP_X_GITHUB_EVENT'] == 'push') {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
The OP NodziGames decided in the comments to go for a more "on demand" approach:
create a Makefile where I can clone, add new files, commit and push via a single command.