Skip to content

Instantly share code, notes, and snippets.



Forked from zph/
Created Mar 15, 2014
What would you like to do?

Want to push to two Git Repos via a single command?

Want to do it easily via a simple .git edit?

My use case is pushing code that resides on Github as well as on Bitbucket. I want it available in both remote locations in case one is unavailable.

Here's how you do it:

Add the two remotes as normal

git remote add origin GIT_LINK_TO_REPO

git remote add bitbucket GIT_LINK_TO_REPO

In local repo, edit .git/config. Find the entry for origin and bitbucket

[remote "origin"]
url =
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "bitbucket"]
url = ssh://
fetch = +refs/heads/*:refs/remotes/bitbucket/*

Add a new entry using that information and urls:

[remote "all"]
url =
url = ssh://

Now when pushing code: git push all

Credit for this solution:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.