Giter Club home page Giter Club logo

gitea-github-sync's Introduction

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.

gitea-github-sync's People

Contributors

muscaw avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.