Git: How to save to two Git repos
I have git repo living on Amazon CodeCommit but I want to save backups on Github or Bitbucket. Here's how:
Step 0 - Change Directory
First change directories to the git repo on your local drive.
Step 1 - Add Bitbucket as a remote backup
You can create a remote git url by adding
remote. In this example, I created a repo on bitbucket with an alias "mybitbucket".
git remote add mybitbucket firstname.lastname@example.org:chrisjmendez/repo.git
Step 2 - Add Github as a second remote backup
git remote add set-url mygithub email@example.com:chrisjmendez/repo.git
Step 3 - Business as usual
Now that you've added two remote backups, you can continue business as usual.
git add -A
git commit -m 'my commit message'
Step 4 - Push to a specific repo
If you want to specifically push to your github repo.
git push -u mygithub
Step 5 - To origin an all remote backups
Push to all repos.
git push -u --all