Ask HN: Good way to mirror many GitHub repos with a self-hosted Gitea?
Is there a pre-built solution to this, or am I going to have to write a script/program that clones from GitHub into Gitea with cron?
Is there a pre-built solution to this, or am I going to have to write a script/program that clones from GitHub into Gitea with cron?
You set up that script as a login shell for a SSH account. Each client is configured with git-config's url.<base>.insteadOf to rewrite Git URLs to go through this SSH endpoint. The script then either clones or pulls from the remote and then serves the client by exec()'ing git-upload-pack from the local copy.
One side effect is that this Git proxy/cache accumulates a complete local copy of everything that was ever cloned or pulled through it. Configure your development system to use it and you have yourself a remote server with an on-disk mirror that tracks everything you've cloned or pulled.
I haven't used this personally in years, but it's still in production as far as I know at my previous job. You can find that script here: https://gist.github.com/boricj/909d3df166af8c5c2fe9fa66bdce8...