Created
January 5, 2021 19:20
-
-
Save bsantraigi/b6241e6c834250db5c2557b17ec5621f to your computer and use it in GitHub Desktop.
Create backup of a Github Repo as a .bundle file. It will contain all remote branches and commit history.
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
# How to run | |
# chmod +x git_backup_repo.sh | |
# ./git_backup_repo.sh https://github.com/bsantraigi/MyRepo.git | |
REPO=$1 | |
echo "Backup: $REPO" | |
DIR=$(grep -o -e "[^/]*.git$" <<< $REPO) | |
# DIR=$? | |
echo "Repo Cloned To: $DIR" | |
git clone --mirror $REPO | |
cd "$DIR"/ | |
pwd | |
git bundle create "../$DIR.bundle" --all | |
cd ../ | |
rm "$DIR" -rf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment