bk99.de entertain the web since 1997

Mirroring self-hosted Git to GitHub automatically

Summary

Johannes describes a post-receive hook that mirrors a self-hosted Git repository to GitHub after every push. The hook runs after a successful push. As downstream services, Johannes names Travis CI and Docker Hub.

Ideas

  • Your own Git server remains the primary remote.
  • A post-receive hook starts the mirroring in an event-driven way.
  • The GitHub mirror can trigger external CI and container services.

Insights

  • Mirrors combine data sovereignty with the integration landscape of large platforms.
  • Automatic replication only becomes reliable once errors become visible.

Facts

  • In this setup, GitHub remains a mirror.

Recommendations

  • Use a deploy key with minimal permissions for the target.
  • Alert on failed mirroring runs and check branch deletions.

References

Read the original article on hanez.org

Search the Web Archive