- Create fresh git repo somewhere without initialising it.
- In your repo push to the new remote
git push https://git-codecommit.us-east-2.amazonaws.comMyClonedRepository --all
Refs:
https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-migrate-repository-existing.html
https://jigarius.com/blog/multiple-git-remote-repositories
git remote add upstream [extra remote url]
Here 'upstream' is the name of the remote pointing to [extra remote url]
See how the tracking is setup for your branches
git branch -vv
Make sure the right branches are pointing to the right remote. Branches can only have one remote to push to. If not correct by setting the right remote push remote.
git branch -u origin/BRANCH
This command sets the 'upstream' (-u) for the current branch to the branch called 'BRANCH' on the remote called 'origin'.
- Say, we call it “all”:
git remote add all [extra remote url].
- Register 1st push URL:
git remote set-url --add --push all [extra remote url]
- Register 2nd push URL:
git remote set-url --add --push all [primary remote].
You cannot pull from multiple remotes, but you can fetch updates from multiple remotes with git fetch --all.
Refs:
https://jigarius.com/blog/multiple-git-remote-repositories
https://www.youtube.com/watch?v=PJN2zVG338w&feature=youtu.be