Bits of Freedom
Bits of Freedom

Tinkerer and thinker on everything free and open. Exploring possibilities and engaging with new opportunities to instigate change.

Jonas Öberg
Author

Jonas is a dad, husband, tinkerer, thinker and traveler. He's passionate about the future and bringing people together, from all fields of free and open.

Share


My Newsletters


If you're interested in what Commons Machinery, Elog.io, or myself are up to, I'd love for you to be part of my notification lists. It's pretty low volume, a few messages per month, depending on which notifications you sign up for. Thanks for taking an interest!

Read more & subscribe

Mirroring from Gitea to GitHub

Jonas ÖbergJonas Öberg

I recently found myself in a situation where I needed to setup a mirror of a repository on FSFE's Gitea installation to Github. As the answer was trivial, but the path to find it was not, I thought to document it here.

  1. Create an empty repository on Github with the name you want the mirror to have. Include some information in the description that it's a mirror of your repository so people can find their way back to the original.

  2. Create a personal access token in Github, which can be used with https basic authentication to write to your repositories. The access token should only have access to write to repositories, nothing else.

  3. On the Gitea side, on the repository which you want to mirror, navigate to Settings->Git hooks and edit the post-receive hook to include a line similar to this: git push --mirror https://<access token>@github.com/<username>/<repository>. This will trigger on each commit to the repository and cause a push of the new commits to Github.

There are separate tools which will allow you to mirror entire organisations' repositories to GitHub, but they typically require some additional tooling. The above, however, is a much easier solution to mirroring individual repositories and doesn't require much besides the single line of post-receive hook.

Jonas Öberg
Author

Jonas Öberg

Jonas is a dad, husband, tinkerer, thinker and traveler. He's passionate about the future and bringing people together, from all fields of free and open.