After many trials and errors, I seem to have figured out a way to achieve this task.
“git-cinnabar” was a dead end for this project. If someone knows how to get it right, I am interested
Using hg-git came already very close and was very straight forward. The basic idea is to work in a Mercurial repository and convert to git if necessary.
With this Mercurial extension installed, you can edit
default = https://www.octave.org/hg/octave
github = git+ssh://email@example.com:gnu-octave/octave.git
hg push github. Works all quite, but the resulting repository is 2 GB in size (the original Mercurial repository weights about 240 MB.
The opposite direction to “hg-git” goes “git-remote-hg”. The basic idea is to work in a git repository that embraces a Mercurial one.
With the git extension installed:
git clone "hg::https://www.octave.org/hg/octave"
# Use compression to shrink 2 GB to 200 MB.
git gc --aggressive
git remote add github firstname.lastname@example.org:gnu-octave/octave.git
# Default "master" branch is immediately available.
# Create local "stable" branch.
git checkout branches/stable
git branch -m stable
# Push with release tags.
git push --tags github
Now to automatically keep the Mercurial and GitHub repos in sync, I established a 5 minutes cron-job with
git pull origin # https://www.octave.org/hg/octave"
git push github master stable # https://github.com/gnu-octave/octave
Final note: also this approach suffers from the lack of object compression in the git repositiory. But in contrast to the “hg-git” approach, one can easily compress the repository locally using the
git gc command.