Push to Multiple Git Repos (Posted on December 22nd, 2012)

Here's a cool little trick I found out about the other day. Even though Git is a distributed revision control system, there are times when you need to push to two systems at once. In my case those systems are Github and Heroku. Here is a simple way to do it by modifying your .git/config file.

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "heroku"]
        url = [email protected]:maxburstein.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "github"]
        url = [email protected]:mburst/burstolio.git
        fetch = +refs/heads/*:refs/remotes/github/*
[remote "origin"]
        url = [email protected]:maxburstein.git
        url = [email protected]:mburst/burstolio.git

The "heroku" and "github" remotes are generated by git and are created in the setup instructional steps of each service respectively. I went ahead and manually added the remote "origin" and just copied the url variable from the other remotes. You'll now be able to push to both by calling "git push origin" and then you can fetch from each one as individually needed.

Tags: Git

Comments:

  • Lucas - 2 years, 6 months ago

    I "figured this out" recently. I stopped using it because pushing to "origin" won't update your remote head for "heroku" and "github". Having some semantic-client-side connections for this could be tricky, so I've just learned to avoid it. (But if you need to do multiple pushed often, and know enough about git to handle the caveats, this works well.)

    reply

  • increase contest votes - 1 month, 1 week ago

    All that safety equipment makes one look kind of like an animal -- big ears, snout, tiny eyes.

    reply

  • nsf - 2 years, 6 months ago

    I just do this: [alias] pub = "!git push pubgit && git push github"

    reply

  • Gergely Polonkai - 2 years, 6 months ago

    Why modify the config directly if git can do it for you? $ git remote add heroku [email protected]:maxburstein.git $ git remote add github [email protected]:mburst/burstolio.git

    reply

  • Max Burstein - 2 years, 6 months ago

    That will work perfectly for setting up the heroku and github branch. However, for pushing to both of them I needed to add a 3rd branch manually that I called origin. If you try to git remote add a url to a branch that already exists it will throw back "fatal: remote heroku already exists". So to get around that I just went ahead and did it manually.

    reply

  • facebook - 2 months ago

    Thanks for sharing the post.. parents are worlds best person in each lives of individual..

    reply

  • simcitu buildit wiki - 1 month, 3 weeks ago

    This is cool post and i enjoy to read this post. your blog is fantastic and you have good staff in your blog. nice sharing keep it up.

    reply

  • Free Minecraft Account 2015 - 1 month, 3 weeks ago

    I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work

    reply

  • code triche clash of clans - 1 month, 3 weeks ago

    Je aime votre poste et tout ce que vous partagez avec nous est uptodate et très instructif, je tiens à ajouter la page donc je peux revenir ici de vous lire, que vous avez fait un travail merveilleux

    reply

  • gameofwar.instantdownloadsz.com - 1 month, 2 weeks ago

    This post is truly inspiring. I like your post and everything you share with us is current and very informative.I'm ԁеfinitеly enϳoуіng youг blοg anԁ look forward to new uρdates.

    reply

  • how to get rid of acne - 1 week, 1 day ago

    This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

    reply

  • free minecraft account list - 1 week, 1 day ago

    I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent.

    reply

  • ipage coupon code - 1 week, 1 day ago

    this is really nice to read..informative post is very good to read..thanks a lot!

    reply

  • read more here - 1 week ago

    An interesting dialogue is price comment. I feel that it is best to write more on this matter, it may not be a taboo topic however usually individuals are not enough to talk on such topics. To the next. Cheers.

    reply

  • ipage coupon code - 1 week, 1 day ago

    this is really nice to read..informative post is very good to read..thanks a lot!

    reply

  • acupuncture nyc - 1 month, 3 weeks ago

    I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance.

    reply

  • cheap seo blogcomments service - 1 month, 3 weeks ago

    Your articles don't displace In regards to the bushes correct t towards part.More Bonuses

    reply

  • No credit check loans online - 1 month, 1 week ago

    I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

    reply

  • History of Plastic - 1 month, 1 week ago

    Love to read it,Waiting For More new Update and I Already Read your Recent Post its Great Thanks.

    reply

  • pregnancy miracle method - 1 week, 1 day ago

    Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.

    reply

  • education news - 2 months, 3 weeks ago

    Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include.

    reply

  • man and van - 1 month, 1 week ago

    I read this article. I think You put a lot of effort to create this article. I appreciate your work.

    reply

  • hack hay day - 2 months, 2 weeks ago

    The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.

    reply

  • marketing1on1.com - 2 months ago

    Blessed I am that I am reading this blessed document these days. I really assumed that the very best of the articles stopped arriving. However immediately after looking over this, my belief rises again

    reply

  • Church Chairs - 1 month, 1 week ago

    Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing

    reply

  • customer reviews about program - 1 week, 5 days ago

    I am genuinely thankful to the holder of this web page who has shared this wonderful paragraph at at this place.

    reply

  • best belt sander - 1 week, 1 day ago

    I like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job

    reply

  • Best Electric Shavers - 1 week ago

    Great stuff from you, man. Ive read your stuff before and you're just too awesome. I love what you've got here, love what you're saying and the way you say it

    reply

  • how can i get rid of pulsatile tinnitus - 5 days, 12 hours ago

    Thanks for sharing Tao of Badass Review useable article - I really increase your acquisition.it is really very informatics post for young people, and hope they will enjoy well after reading this post.

    reply

  • rebel mouse com - 1 week, 5 days ago

    Should there be another persuasive post you can share next time, I’ll be surely waiting for it.

    reply

  • 15 pr 1+ relevant links - 3 days, 10 hours ago

    Excellent and very exciting site. Love to watch. Keep Rocking.

    reply

  • affordable small business SEO services - 2 months ago

    This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.

    reply

  • fiverr backlinks - 1 week ago

    This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this

    reply

  • power of attorney registration - 1 month, 3 weeks ago

    This blog has got lots of really helpful information on it! Cheers for sharing it with me!

    reply

  • Click for source - 1 month, 2 weeks ago

    This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post about ultrasound technician.

    reply

  • mybestwebhostingoffers.com - 1 month, 2 weeks ago

    Thanks for writing engaging and interesting material.Found this on MSN and I’m happy I did. Well written article.

    reply

  • turbulence training - 1 month, 2 weeks ago

    Do you mind updating your blog post with additional insight? It should be really useful for all of us.

    reply

  • www.rebelmouse.com/ - 1 week, 4 days ago

    At last, Guilt-Free Desserts has been created to allow those of us who loves our desserts but still embrace the need for nutrition to create stunning desserts that nobody would guess are actually made from low GI foods.

    reply

  • visit this website - 1 month, 2 weeks ago

    Thanks a lot for providing individuals with a spectacular possibility, I am always searching online for articles that can help me.

    reply

  • 8 ball pool cheat - 2 months, 2 weeks ago

    Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.

    reply

  • John Esslemont - 2 days, 15 hours ago

    I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

    reply

  • https://www.vimeo.com - 1 day, 15 hours ago

    I likewise profit from taking in the appraisals, however discover that alot of individuals should stay on article to attempt and include worth toward the real weblog discharge.

    reply

  • walkfit in stores - 2 months, 1 week ago

    Thank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read.

    reply

  • buy facebook likes - 2 months ago

    Very good points you wrote here..Great stuff...I think you've made some truly interesting points.Keep up the good work.

    reply

  • buy pinterest followers - 2 months ago

    Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post.

    reply

  • ville a monaco - 1 month, 3 weeks ago

    I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject?

    reply

  • specs - 1 month, 2 weeks ago

    Easily, the article is actually the best topic on this registry related issue. I fit in with your conclusions and will eagerly look forward to your next updates.

    reply

  • High School Diploma at Home - 1 month, 2 weeks ago

    Good post you have shared here keep it up.

    reply

  • Blog - 1 month, 1 week ago

    Thanks for sharing the post..parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family.

    reply

  • http://pdflirt.com/http://pdflirt.com/michael-fior - 1 month, 1 week ago

    Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have.

    reply

  • indem Sie hier klicken - 1 month, 1 week ago

    Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. sfsdfsdf

    reply

  • uali20 - 1 month ago

    Very Nice Brewery in Nederland is another nano to take a look at. Fantastic beers and already have quite the following.<a href="http://besttabletunder100.com/">Best tablet under 100</a>

    reply

  • inexpensive bridesmaid dresses - 1 month ago

    I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.

    reply

  • blog - 1 month ago

    I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.

    reply

  • ​Mickey mouse wall stickers - 1 month ago

    Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing...

    reply

  • executive sober living ny - 1 month ago

    I really appreciate that you wrote this article and shared some really good information on this specific topic.

    reply

  • garden coop - 1 month ago

    Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..

    reply

  • Investing in Gold - 1 month ago

    We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work.

    reply

  • snapdeal coupons - 1 week, 2 days ago

    Good thing is that we can see so many positive comments on this post. Thanks.

    reply

  • how do you get more instagram followers - 1 week, 1 day ago

    I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..

    reply

  • Rebelmouse - 1 week ago

    Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one.

    reply

  • Jarvis - 6 days, 9 hours ago

    Hello There. I found your blog using msn. This is an extremely well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback.

    reply

  • rebelmouse.com/bobbyriomagneticmessaging - 6 days, 8 hours ago

    I have been checking out a few of your stories and I can state pretty good stuff. I will definitely bookmark your blog.

    reply

  • Schlüsseldienst Berlin - 5 days, 15 hours ago

    I might want to thank you for the endeavors you have made in composing this article. I am trusting the same best work from you later on also..

    reply

  • best diet to get ripped quick - 5 days, 8 hours ago

    Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts.

    reply

  • volver con el descargar pdf - 4 days, 14 hours ago

    Thank you for this great I definitely loved every little bit of it.

    reply

  • Insanity Workout Review - 4 days, 12 hours ago

    I fit in with your conclusions and will eagerly look forward to your next updates. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates.

    reply

  • how to get more instagram followers - 3 days, 9 hours ago

    I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.

    reply

  • how to get alot of likes on instagram - 3 days, 9 hours ago

    Thanks so much for this information. I have to let you know I concur on several of the points you make here and others may require some further review, but I can see your viewpoint.

    reply

  • girlfriend activation by christian h. - 3 days, 8 hours ago

    This article is something that will help me with my class assignment. It helped me to better understand another aspect of this topic. Thanks.

    reply

  • Manual Testing Training in Chennai - 3 days, 7 hours ago

    Informative article. Thanks.

    reply

  • wholesale watches - 2 days, 11 hours ago

    Wonderful illustrated information. I thank you about that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject!

    reply

  • voyance - 15 hours ago

    I have to voice my passion for your sharpness in writing and giving acknowledgment to people.

    reply

  • voyance en ligne - 15 hours ago

    Thanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future.

    reply

  • voyance en direct - 15 hours ago

    I have to voice my passion for your sharpness in writing and giving acknowledgment to people.

    reply

  • Angel Investor in India - 9 hours ago

    I have been checking out a few of your stories and i can state pretty good stuff. I will definitely bookmark your blog.

    reply

  • Fundraising platform in India - 9 hours ago

    Thanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future

    reply

  • Angel investors in India - 9 hours ago

    I have to voice my passion for your sharpness in writing and giving acknowledgment to people.

    reply

  • Buy Twitter Followers - an hour ago

    I think that thanks for the valuabe information and insights you have so provided here.

    reply