- Clone the repo
git clone --mirror https://github.com/vuejs/vue
cd
into the cloned repo- Create a bundle file in the parent directory
git bundle create ../vuejs_vue.bundle --all
- That bundle file is now a full archive of the repo, including all of its branches and tags
Here we will restore the repo from the bundle and create a new remote origin that will contain all brnaches and tags
- Clone the repo from the bundle
git clone vuejs_vue.bundle
- Get all the branches locally to be pushed up to your origin later (from: https://gist.github.com/grimzy/a1d3aae40412634df29cf86bb74a6f72)
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
- Create a new repo on your git server and update the origin of the local repo
git remote set-url origin [email protected]/xtream1101/test-backup.git
- Push all branches and tags to the new remote origin
git push --all
git push --tags
@keyserjaya This reply is pretty late (I just came across this script), but this is a
bash
(shell) script meant to be run in a Linux shell. If you have WSL2 installed, you can likely use the command line in a virtual instance of Linux to run the script, but it will not be supported by Windows PowerShell.If you have
git for Windows
installed, you likely have a Bash terminal (shortcut in the Start Menu) which can run some Shell scripts but Bash on Windows does not support things likegrep
commands out-of-the-box. (There may be third-party Windows tools that simulate the program's functionality -- seewget
for example -- but not that I know of forgrep
in particular.