Last active
May 5, 2021 15:58
-
-
Save thespacedoctor/2b9a9a08becf0eaa276f to your computer and use it in GitHub Desktop.
[Git Repo and Github Sync] Place at the root of a git repo and run from cron to schedule syncs with remote repo #sync #github #repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -x /usr/local/bin/keychain ]; then | |
/usr/local/bin/keychain ~/.ssh/id_rsa | |
. ~/.keychain/`/bin/hostname`-sh | |
fi | |
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
HOST="$(hostname)" | |
cd $DIR | |
git add . --all | |
git commit -m 'cron-job on '$HOST | |
git pull | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment