Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr2130 :: Git push to two repositories at once

Klaatu demonstrates how to perform one git push to two separate repositories

<< First, < Previous, , Latest >>

Hosted by Klaatu on 2016-09-30 is flagged as Clean and is released under a CC-BY-SA license.
git, git push, multiple repositories. 4.
The show is available on the Internet Archive at: https://archive.org/details/hpr2130

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:24:24

Version Control.

This is an open series in which Hacker Public Radio Listeners can share their knowledge and experience of version or revision control systems such as Bazaar, Mercurial, Subversion, CVS and Git.

  1. Set up your git remotes (‘origin’ and ‘foo’)

  2. Create a new remote (‘all’) entry to encompass the existing targets

  3. Adjust ssh config as needed

  4. git push all HEAD


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2016-10-02 14:12:28 by clacke

I figured :-)

I thought, "Hey, this is probably useful if you want to host something at gitlab and have an unofficial clone at ". One minute later ... yep. :-)

Comment #2 posted on 2016-10-02 16:11:54 by clacke

explicit push

Very cool discovery! I never even considered the idea that you could have several URLs for a remote.

As you mentioned that this kind of mixed remote would make it "impossible" (without adding remotes) to push to only one of the URLs, I though I should mention something that probably not everyone knows:

You don't need to set up a remote to fetch or push. You can use an explicit URL instead of a remote name:

git push ssh://my.server/~/git/myrepo HEAD:master

In fact, because I forget what the various options are for managing references/branches, I often use this to remove a reference in the local repository.

git push . :refs/heads/whatever_branch

Comment #3 posted on 2016-10-08 09:17:18 by klaatu

explicit push

Funny you mention the explicit push. I knew about it, or at least I knew about the explicit pull, because I use it when migrating git repositories at work...but only with local URI's. It never dawned on me that it could be done with non-local URI's. Thanks for the tip!

Comment #4 posted on 2016-11-02 12:20:52 by Dave Morriss

Thought I'd never use this

This was interesting, but I thought I'd never use it. However, I had an instance recently where making a GitHub copy of a repository on a GitLab instance was desirable. It was straightforward to set up and worked flawlessly.

Thanks for explaining the process.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?