arnaucube
arnaucube/mirror-to-giteaPublic Self-hosted repository
mirror-to-gitea/README.md
README.mdRaw
  1# Mirror your github repositories to your gitea server
  2
  3## Badges
  4
  5[![image pulls](https://img.shields.io/docker/pulls/jaedle/mirror-to-gitea.svg)](https://cloud.docker.com/repository/docker/jaedle/mirror-to-gitea)
  6[![microbadger analysis](https://images.microbadger.com/badges/image/jaedle/mirror-to-gitea.svg)](https://microbadger.com/images/jaedle/mirror-to-gitea "Get your own image badge on microbadger.com")
  7
  8## Description
  9
 10`mirror-to-gitea` automatically creates repository mirrors from a Github User to your gitea server. The hard work (
 11continous mirroring) is done by Gitea on a continuous basis.
 12
 13### Modes
 14
 15There a different usage modes:
 16
 171. mirror **only public** repositories: No authentication on Github required. You may utilize an optional Github token
 18   to avoid rate limits
 192. Mirror **public and private** repositories: Authentication for Github required.
 20
 21### Prerequisites
 22
 23#### Mandatory
 24
 25- Something to mirror from Github (repositories from a Github user)
 26- An application token for a gitea instance
 27
 28#### Optional
 29
 30- A Github token (to *avoid rate limits* or to *mirror private repositories*)
 31
 32### Examples
 33
 34#### Mirror public repositories
 35
 36A github user `github-user` has the public repositories `dotfiles` and `zsh-config`. Starting the script with a gitea
 37token for the account `gitea-user` will create the following mirror repositories:
 38
 39- github.com/github-user/dotfiles ← some-gitea.url/gitea-user/dotfiles
 40- github.com/github-user/zsh-config ← some-gitea.url/zsh-config/dotfiles
 41
 42The mirror settings are default by your gitea instance.
 43
 44#### Mirror private repositories
 45
 46You obtained a github token for `github-user` which has a public repository `public-example` a private
 47repository `private-example`. Running the mirroring process for `gitea-user` will create the following mirror
 48repositories:
 49
 50- github.com/github-user/public-example ← some-gitea.url/gitea-user/public-example
 51- github.com/github-user/private-example ← some-gitea.url/zsh-config/private-example
 52
 53The mirror settings are default by your gitea instance.
 54
 55## Run public repository mirrors
 56
 57### Parameters
 58
 59#### Mirror public repositories
 60
 61##### Mandatory
 62
 63- `GITHUB_USERNAME` name of user with public repos should be mirrored
 64- `GITEA_URL` url of your gitea server
 65- `GITEA_TOKEN` token for your gitea user
 66
 67##### Optional
 68
 69- `MIRROR_REPOSITORIES` `PUBLIC` (optional, is default)
 70- `GITHUB_TOKEN` Github personal access token (optional to avoid rate limits)
 71
 72```sh
 73docker container run \
 74 -d \
 75 --restart always \
 76 -e MIRROR_REPOSITORIES='PUBLIC' \
 77 -e GITHUB_USERNAME='github-user' \
 78 -e GITHUB_TOKEN='<optional-github-token>' \
 79 -e GITEA_URL=https://some-gitea.url \
 80 -e GITEA_TOKEN='<gitea-token>' \
 81 jaedle/mirror-to-gitea:latest
 82```
 83
 84This will a spin up a docker container running infinite which will try to mirror all your repositories once every hour
 85to your gitea server.
 86
 87## Run private repository mirrors
 88
 89##### Mandatory
 90
 91- `MIRROR_MODE` 'PRIVATE_AND_PUBLIC'
 92- `GITHUB_TOKEN` Github personal access token
 93- `GITEA_URL` url of your gitea server
 94- `GITEA_TOKEN` token for your gitea user
 95
 96```sh
 97docker container run \
 98 -d \
 99 --restart always \
100 -e MIRROR_MODE='PRIVATE_AND_PUBLIC' \
101 -e GITHUB_TOKEN='<github-token>' \
102 -e GITEA_URL=https://some-gitea.url \
103 -e GITEA_TOKEN=please-exchange-with-token \
104 jaedle/mirror-to-gitea:latest
105```