git push from one remote to another code example

Example 1: git push to all remotes

#To push all branches to all remotes:
git remote | xargs -L1 git push --all

#Or if you want to push a specific branch to all remotes:
#Replace master with the branch you want to push.
git remote | xargs -L1 -I R git push R master

#(Bonus) To make a git alias for the command:
git config --global alias.pushall '!git remote | xargs -L1 git push --all'

Example 2: how to push code to another remote git repository

git remote rename origin upstream
git remote add origin URL_TO_GITHUB_REPO
git push origin master