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

Reply via email to