Skip to content

Instantly share code, notes, and snippets.

@yene
Created January 5, 2015 12:13
Show Gist options
  • Save yene/3ae149b340dc6a1491f8 to your computer and use it in GitHub Desktop.
Save yene/3ae149b340dc6a1491f8 to your computer and use it in GitHub Desktop.
Backup git repos to synology nas
#!/bin/ash
ssh git@ip expand > repos.txt
myarr=$(awk '{print $NF}' repos.txt)
counter=0
for i in $myarr
do
counter=$(($counter+1))
if [ "$counter" -eq 1 ] || [ "$counter" -eq 2 ]
then
continue
fi
git clone --mirror git@ip:$i $i
git --git-dir $i remote update
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment