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.
Set up your git remotes (‘origin’ and ‘foo’)
Create a new remote (‘all’) entry to encompass the existing targets
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 :).