https://docs.github.com/en/repositories/archiving-a-github-repository/backing-up-a-repository
Backing up a repository
You can use the API or a third-party tool to back up your repository.
To download an archive of your repository, you can use the API for user or organization migrations. For more information, see "Migrations."
Once you have downloaded your archive, you can copy it to an external hard drive and/or upload it to a cloud-based backup or storage service such as Azure Blob Storage, Google Drive or Dropbox.
Migrations
https://docs.github.com/en/rest/migrations?apiVersion=2022-11-28
Third-party backup tools
A number of self-service tools exist that automate backups of repositories. Unlike archival projects, which archive all public repositories on GitHub that have not opted out and make the data accessible to anyone, backup tools will download data from specific repositories and organize it within a new branch or directory. For more information about archival projects, see "About archiving content and data on GitHub." For more information about self-service backup tools, see the Backup Utilities category on GitHub Marketplace.
https://docs.github.com/en/repositories/archiving-a-github-repository/about-archiving-content-and-data-on-github#about-the-github-archive-program
https://github.com/marketplace?category=backup-utilities
You can also have an on-premises endpoint synchronize with all of your repos. That endpoint is backed up.