Skip to content

Instantly share code, notes, and snippets.

@renatomefi
Created March 15, 2015 22:49
Show Gist options
  • Save renatomefi/2b662e6acb0162edf6ab to your computer and use it in GitHub Desktop.
Save renatomefi/2b662e6acb0162edf6ab to your computer and use it in GitHub Desktop.
Simple script to update your git mirrors, with different ssh keys and paths
#!/usr/bin/ssh-agent bash
# Script for updating git mirror repositories
# $1 repository
# $2 ssh key
echo "$(date +'%F %H:%M:%S') Start updating the mirror repository: " $1
ssh-add $2
echo "Key added: " $2
git --git-dir=$1 remote update
echo "$(date +'%F %H:%M:%S') Updating end --------"
@renatomefi
Copy link
Author

Want to automatically update your repos evey minute?

Add it to crontab:

0 * * * * git-mirror-update.sh YOUR_REPO.git YOUR_PRIVATE_KEY >> /var/log/git-mirror-update.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment