Skip to main content

Supported Python Versions PyPI version

codecov PyPI - Downloads

gitea-github-sync

gitea-github-sync provides a simple CLI to sync Github repositories to your Gitea instance.

Installation

pip install gitea-github-sync

If you are interested in using a pre-packaged docker image, please look at the Docker Readme

Setup

Create a file in $HOME/.config/gitea-github-sync/config.yml with the following template and fill up the missing values:

gitea_api_url: https://<your-gitea-instance>/api/v1
gitea_token: <your-gitea-token>
github_token: <your-github-token>

Creating a Gitea token

Go to https://<your-local-gitea-instance>/user/settings/applications and generate a new token.

Creating a Github token

Go to https://github.com/settings/tokens/new and create a token with the following values set:

  • Note: this is a note to help you understand how the token is used.
  • Expiration: No expiration
  • repo: Select all of repo

Screenshot of token configuration

Github token limitation

Github allows you to create Personal access tokens. These tokens now exist in two different flavors:

  • Fine-grained tokens
  • Classic tokens

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.

Usage

gitea-github-sync --help Shows the help

gitea-github-sync list-all-gitea-repositories Lists all available Gitea repositories in your account

gitea-github-sync list-all-github-repositories Lists all available Github repositories in your account

gitea-github-sync migrate-repo FULL_REPO_NAME Migrates one repo from Github to Gitea

gitea-github-sync sync Migrates all repos not present in Gitea from Github

Automate gitea-github-sync execution

There are multiple ways to automate the execution of gitea-github-sync. One of them is using cron:

First, execute crontab -e to open the cron configuration file in edit mode.

Then add the following line:

0 12 * * * gitea-github-sync sync

This will execute the sync operation every day at twelve.

Limitations

When using the migration feature of Gitea, a Github token must be passed for Gitea to continuously pull the new changes from Github.

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.

Metadata

Release files for gitea-github-sync 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitea-github-sync 0.2.0
File Size Uploaded
gitea_github_sync-0.2.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitea-github-sync 0.2.0
File Interpreter ABI Platform
gitea_github_sync-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / gitea_github_sync-0.2.0.tar.gz

Download URL gitea_github_sync-0.2.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d46a343a2907195cd9174a7f9625c92ee4333a804120b0cdf72a79be6ac31d5e
BLAKE2b-256 checksum
How to use checksums
7b4f3bf9144de73f47afcc3883203e4bf0935ce6279e865c022cb16f3db40dcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.18 Linux/6.5.0-1021-azure

Release files / gitea_github_sync-0.2.0-py3-none-any.whl

Download URL gitea_github_sync-0.2.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
836d2ec8e16c44a7fafe57a4e29638106f6c3ff11a954f3ec144c22b6c9d0ae6
BLAKE2b-256 checksum
How to use checksums
fc962e18e1b7fbc1f2ff60832c7011ceca2aa4dff82c070adb1bbdda3be51db8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.8.18 Linux/6.5.0-1021-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page