git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Keeping a non-1:1 mirror in sync and keeping private branches

From
JDJan Danielsson <jan.m.danielsson@gmail.com>
Date
Jul 16, 2017, 00:59 UTC
Message-ID
<699d0274-285f-3d30-654d-d9ca59fe4dce@gmail.com>
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
Next: Jeff King
Message 1 of 4 in “Keeping a non-1:1 mirror in sync and keeping private branches”
  1. Jan DanielssonJul 16, 2017
  2. Jeff KingJul 16, 2017
  3. Jan DanielssonJul 16, 2017
  4. Jeff KingJul 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.