git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Keeping a non-1:1 mirror in sync and keeping private branches
@ 2017-07-16  0:59 Jan Danielsson
  2017-07-16 10:10 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Danielsson @ 2017-07-16  0:59 UTC (permalink / raw)
  To: git

Hello,

   Let's say there'a s hosting service hosting a repository which I want
to self-host.  I don't just want to do a mirror, but I want to keep it
in sync (using a cronjob).  In addition, I want to have private branches
on the self-hosted repository.  (In this particular case, the "hosting
service" is github, and "self-hosting" is bitbucket -- but I'm looking
for a solution which is agnostic with regards to hosting service(s)).

   Searching, reading and asking around led me to the following (these
are scripts which are run on a separate system which acts as a git bridge):

   init:

   git clone --mirror $UPSTREAMURL $DSTDIR
   cd $DSTDIR
   git remote rename origin upstream
   git config remotes.default 'upstream'
   git remote add --mirror=push origin $DOWNSTREAMURL

   And then to keep self-hosted repository in sync with upstream:

   cd $DSTDIR
   git remote update --prune
   git push

   This seems to accomplish everything I want except that the the "git
push" deletes any branches I have created on my self-hosted repository.

   Am I doing it completely wrong?  If not, how do I make my branches
survive the push?

-- 
Kind regards,
Jan Danielsson


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-16 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-16  0:59 Keeping a non-1:1 mirror in sync and keeping private branches Jan Danielsson
2017-07-16 10:10 ` Jeff King
2017-07-16 13:42   ` Jan Danielsson
2017-07-16 14:16     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).