The following assumptions are made:
- you are on branch
main
- your local working tree is clean
- you have the remote
origin
currently in place - you want to switch to a new remote
mirror_github
- you want to get rid of your old remote
origin
Here is what needs to be done:
git remote add mirror_github github:user/repo.git
git fetch --prune mirror_github
git reset --hard mirror_github/main
git clean -f -d
git switch -C main mirror_github/main
git remote remove origin