mirror of
https://github.com/arnaucube/mirror-to-gitea.git
synced 2026-02-07 03:26:45 +01:00
update readme
This commit is contained in:
109
README.md
109
README.md
@@ -7,52 +7,99 @@
|
||||
|
||||
## Description
|
||||
|
||||
This script mirrors automatically the public 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.
|
||||
`mirror-to-gitea` automatically creates repository mirrors from a Github User to your gitea server. The hard work (
|
||||
continous mirroring) is done by Gitea on a continuous basis.
|
||||
|
||||
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:
|
||||
### Modes
|
||||
|
||||
There a different usage modes:
|
||||
|
||||
1. mirror **only public** repositories: No authentication on Github required. You may utilize an optional Github token
|
||||
to avoid rate limits
|
||||
2. Mirror **public and private** repositories: Authentication for Github required.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
#### Mandatory
|
||||
|
||||
- Something to mirror from Github (repositories from a Github user)
|
||||
- An application token for a gitea instance
|
||||
|
||||
#### Optional
|
||||
|
||||
- A Github token (to *avoid rate limits* or to *mirror private repositories*)
|
||||
|
||||
### Examples
|
||||
|
||||
#### Mirror public repositories
|
||||
|
||||
A github user `github-user` has the 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.
|
||||
|
||||
## Prerequisites
|
||||
#### Mirror private repositories
|
||||
|
||||
- Something to mirror (a github user or organization with public repos)
|
||||
- Gitea instance up and running
|
||||
- User for Gitea with generated token
|
||||
- Docker
|
||||
You obtained a github token for `github-user` which has a public repository `public-example` a private
|
||||
repository `private-example`. Running the mirroring process for `gitea-user` will create the following mirror
|
||||
repositories:
|
||||
|
||||
## Run it
|
||||
- github.com/github-user/public-example ← some-gitea.url/gitea-user/public-example
|
||||
- github.com/github-user/private-example ← some-gitea.url/zsh-config/private-example
|
||||
|
||||
The mirror settings are default by your gitea instance.
|
||||
|
||||
## Run public repository mirrors
|
||||
|
||||
### Parameters
|
||||
|
||||
#### Mirror public repositories
|
||||
|
||||
##### Mandatory
|
||||
|
||||
- `GITHUB_USERNAME` name of user with public repos should be mirrored
|
||||
- `GITEA_URL` url of your gitea server
|
||||
- `GITEA_TOKEN` token for your gitea user
|
||||
|
||||
##### Optional
|
||||
|
||||
- `MIRROR_REPOSITORIES` `PUBLIC` (optional, is default)
|
||||
- `GITHUB_TOKEN` Github personal access token (optional to avoid rate limits)
|
||||
|
||||
```sh
|
||||
docker container run \
|
||||
-d \
|
||||
--restart always \
|
||||
-e GITHUB_USERNAME=github-user \
|
||||
-e MIRROR_REPOSITORIES='PUBLIC' \
|
||||
-e GITHUB_USERNAME='github-user' \
|
||||
-e GITHUB_TOKEN='<optional-github-token>' \
|
||||
-e GITEA_URL=https://some-gitea.url \
|
||||
-e GITEA_TOKEN='<gitea-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.
|
||||
|
||||
## Run private repository mirrors
|
||||
|
||||
##### Mandatory
|
||||
|
||||
- `MIRROR_MODE` 'PRIVATE_AND_PUBLIC'
|
||||
- `GITHUB_TOKEN` Github personal access token
|
||||
- `GITEA_URL` url of your gitea server
|
||||
- `GITEA_TOKEN` token for your gitea user
|
||||
|
||||
```sh
|
||||
docker container run \
|
||||
-d \
|
||||
--restart always \
|
||||
-e MIRROR_MODE='PRIVATE_AND_PUBLIC' \
|
||||
-e GITHUB_TOKEN='<github-token>' \
|
||||
-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` [GitHub personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) (optional)
|
||||
- `GITEA_URL` url of your gitea server
|
||||
- `GITEA_TOKEN` token for your gitea user
|
||||
|
||||
## 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..
|
||||
|
||||
Reference in New Issue
Block a user