Skip to content

Instantly share code, notes, and snippets.

@pirafrank
Created December 17, 2018 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirafrank/0be58762445c10b8d377c7d97985b034 to your computer and use it in GitHub Desktop.
Save pirafrank/0be58762445c10b8d377c7d97985b034 to your computer and use it in GitHub Desktop.
mirror your git repos to make a backup
#!/bin/bash
for url in $(ssh git.example.com ls-urls)
do
echo "Cloning $url ..."
git clone --mirror "$url"
done
#!/bin/sh
# place this file into /home/git/git-shell-commands/ls-urls
baseurl="git@git.example.com:/home/git/repos/"
ls -A1 /home/git/repos | xargs -I {} echo "$baseurl"{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment