Skip to main content

git: pushing to multiple repos

You can push to more then one instance but fetch/pull only from one. Main repo will be set:

git remote add origin https://github.com/SimpelMe/REPO.git
Set both or more push urls:
git remote set-url --add --push origin https://github.com/SimpelMe/REPO.git
git remote set-url --add --push origin ZelckC@oxford:/opt/git/abf-tools.git/REPO.git
cat .git/config

shows for instance:

[remote "origin"]
    url = git@github.com:namespace/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    pushurl = git@github.com:namespace/repo.git
    pushurl = git@gitlab.com:namespace/repo.git

Source: alexarmstrong.net/2015/01/pushing-to-multiple-git-repos