Skip to main content

Syncs your gitea instance with your Github account

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitea_github_sync-0.1.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitea_github_sync-0.1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file gitea_github_sync-0.1.2.tar.gz.

File metadata

  • Download URL: gitea_github_sync-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1042-azure

File hashes

Hashes for gitea_github_sync-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6bfb313f4dec4c9347c3aa7552d9fa74e2cdf801687a6d83c7b4877b3d94f138
MD5 8cb39414a1b15c17fdac9d8aad7459e0
BLAKE2b-256 0fb0d245f3a9206d124b11dd3006930393da759fc76c62ceed4476672368e334

See more details on using hashes here.

File details

Details for the file gitea_github_sync-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gitea_github_sync-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1042-azure

File hashes

Hashes for gitea_github_sync-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e62ea2009fffe9250ca92c5887b570f8484e1776e16e19ce29646a365ff1ff48
MD5 f0e215c799094456203f67ed5bc3ed54
BLAKE2b-256 8c69a0feeb862727b5a7ef15917ab95cce64dd7acb60a99500ff1c46da9210cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page