Please note: this is written from the perspective of using the Git Bash shell.
- Clone the repository to be copied into a new location to ensure it is a fresh checkout
git clone old-repo-url checkout-location
cdinto checkout-location, and run the following to checkout all branches from the remote:
for remote in `git branch -r | grep -v HEAD`; do git checkout --track $remote; done
- If it doesn’t already exist, create the new remote repository e.g.
- Add a new remote that points to the new repository:
git remote add new-repo new-repo-url
- Run the following to push all branches to the new remote:
git push --all new-repo