|
| 1 | +# gitea-github-sync |
| 2 | + |
| 3 | +gitea-github-sync provides a simple CLI to sync Github repositories to your Gitea instance. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +``` |
| 8 | +pip install gitea-github-sync |
| 9 | +``` |
| 10 | + |
| 11 | +## Setup |
| 12 | +Create a file in `$HOME/.config/gitea-github-sync/config.yml` with the following template and fill up the missing values: |
| 13 | + |
| 14 | +```yaml |
| 15 | +gitea_api_url: https://<your-gitea-instance>/api/v1 |
| 16 | +gitea_token: <your-gitea-token> |
| 17 | +github_token: <your-github-token> |
| 18 | +``` |
| 19 | +
|
| 20 | +### Creating a Gitea token |
| 21 | +Go to https://\<your-local-gitea-instance\>/user/settings/applications and generate a new token. |
| 22 | +
|
| 23 | +### Creating a Github token |
| 24 | +
|
| 25 | +Go to https://github.com/settings/tokens/new and create a token with the following values set: |
| 26 | +- Note: this is a note to help you understand how the token is used. |
| 27 | +- Expiration: No expiration |
| 28 | +- repo: Select all of repo |
| 29 | +
|
| 30 | + |
| 31 | +
|
| 32 | +#### Github token limitation |
| 33 | +Github allows you to create _Personal access tokens_. These tokens now exist in two different flavors: |
| 34 | +- Fine-grained tokens |
| 35 | +- Classic tokens |
| 36 | +
|
| 37 | +Both work with gitea-github-sync, but given that Gitea does not allow the modification of the access token through the API, a **non-expiring** token must be used which limits the usage to Classic tokens. |
| 38 | +
|
| 39 | +## Usage |
| 40 | +
|
| 41 | +`gitea-github-sync --help` Shows the help |
| 42 | + |
| 43 | +`gitea-github-sync list-all-gitea-repositories` Lists all available Gitea repositories in your account |
| 44 | + |
| 45 | +`gitea-github-sync list-all-github-repositories` Lists all available Github repositories in your account |
| 46 | + |
| 47 | +`gitea-github-sync migrate-repo FULL_REPO_NAME` Migrates one repo from Github to Gitea |
| 48 | +` |
| 49 | +`gitea-github-sync sync` Migrates all repos not present in Gitea from Github |
| 50 | + |
| 51 | +## Limitations |
| 52 | + |
| 53 | +When using the migration feature of Gitea, a Github token must be passed for Gitea to continuously pull the new changes from Github. |
| 54 | + |
| 55 | +The token used by gitea-github-sync to list repositories is the same that is used by Gitea for continuous monitoring. Updating the value of this token is unfortunately not possible through the API as of now. |
0 commit comments