From: Jan Danielsson <jan.m.danielsson@gmail.com>
To: git@vger.kernel.org
Subject: Keeping a non-1:1 mirror in sync and keeping private branches
Date: Sun, 16 Jul 2017 02:59:23 +0200 [thread overview]
Message-ID: <699d0274-285f-3d30-654d-d9ca59fe4dce@gmail.com> (raw)
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 reply other threads:[~2017-07-16 0:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-16 0:59 Jan Danielsson [this message]
2017-07-16 10:10 ` Keeping a non-1:1 mirror in sync and keeping private branches Jeff King
2017-07-16 13:42 ` Jan Danielsson
2017-07-16 14:16 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=699d0274-285f-3d30-654d-d9ca59fe4dce@gmail.com \
--to=jan.m.danielsson@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).