Created
October 29, 2013 02:57
-
-
Save codeck/7208519 to your computer and use it in GitHub Desktop.
git backup
modify from http://sethrobertson.github.io/GitBestPractices/#backups
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 | |
GITHOST=scm@192.168.100.221 | |
GITPATH=gitroot | |
cd ~/${GITPATH}_backup | |
ls -F . | grep / > /tmp/.gitmissing1 | |
eval ssh -n $GITHOST ls -F ${GITPATH}/. | grep / > /tmp/.gitmissing2 | |
diff /tmp/.gitmissing1 /tmp/.gitmissing2 | egrep '^>' | | |
while read x f; do | |
git clone --bare --mirror ${GITHOST}:${GITPATH}/$f $f | |
done | |
rm -f /tmp/.gitmissing1 /tmp/.gitmissing2 | |
for f in */.; do (cd $f; echo $f; git fetch); done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment