Go to file
Nelson Dane 5d837c0dbc Fix public and private repos 2023-02-03 01:29:38 -05:00
src Fix public and private repos 2023-02-03 01:29:38 -05:00
.dockerignore initial commit 2019-03-09 13:47:07 +01:00
.gitignore Fix public and private repos 2023-02-03 01:29:38 -05:00
Dockerfile Fix public and private repos 2023-02-03 01:29:38 -05:00
LICENSE initial commit 2019-03-09 13:47:07 +01:00
README.md Updated readme 2021-05-16 12:08:32 +02:00
docker-entrypoint.sh initial commit 2019-03-09 13:47:07 +01:00
package-lock.json Fix public and private repos 2023-02-03 01:29:38 -05:00
package.json fix: upgrade octokit to fix 'TypeError: Octokit is not a constructor' 2021-01-11 23:11:31 +01:00
run-local.sh initial commit 2019-03-09 13:47:07 +01:00

README.md

Mirror your github repositories to your gitea server

Badges

image pulls microbadger analysis

Description

This script mirrors automatically the repositories from a github-user or github-organization to your gitea server. It will - once started - create a mirrored repository under a given token for a gitea user fully automatically.

Example: A github user github-user has public repositories dotfiles and zsh-config. Starting the script with a gitea token for the account gitea-user will create the following mirror repositories:

  • github.com/github-user/dotfiles ← some-gitea.url/gitea-user/dotfiles
  • github.com/github-user/zsh-config ← some-gitea.url/zsh-config/dotfiles

The mirror settings are default by your gitea instance.

It is also possible to mirror private repos but it is not default behavior. For that you will have to set the correct paremeters, see here

Prerequisites

  • Something to mirror (a github user or organization with repos)
  • Gitea instance up and running
  • User for Gitea with generated token
  • Docker

Run it

docker container run \
 -d \
 --restart always \
 -e GITHUB_USERNAME=github-user \
 -e GITEA_URL=https://some-gitea.url \
 -e GITEA_TOKEN=please-exchange-with-token \
 jaedle/mirror-to-gitea:latest

This will a spin up a docker container running infinite which will try to mirror all your repositories once every hour to your gitea server.

Parameters

  • GITHUB_USERNAME name of user or organization which public repos should be mirrored
  • GITHUB_TOKEN(optional) GitHub personal access token. Attention: if this is set, the token will be transmitted to your specified Gitea instance!
  • GITEA_URL url of your gitea server
  • GITEA_TOKEN token for your gitea user
  • MIRROR_PRIVATE_REPOSITORIES(optional) if set to 'true', your private GitHub repositories will be mirrored. The GITHUB_TOKEN parameter must be set for this to work.

Things to do

  • refactoring
  • think about how to test
  • configurable interval
  • better logging
  • use github token to solve problems with rate limits
  • add gitlab support
  • and so on..