varunsridharan / github-gitea-mirror

Simple Python Script To Mirror Repository From Github To Gitea
MIT License
177 stars 20 forks source link

Gitea throws error 400 when mirroring starred repository #9

Open Jefferderp opened 1 year ago

Jefferderp commented 1 year ago

Hello!

When the script attempts to mirror a starred repository, my local Gitea instance throws the following error:

[28/01/2023 16:57:47]    ⭐  Star'ed Repository : Julow/Unexpected-Keyboard
400 [{"classification":"DeserializationError","message":"json: cannot unmarshal string into Go struct field MigrateRepoOptions.uid of type int64"}] {"repo_name": "Unexpected-Keyboard", "description": "A lightweight virtual keyboard for developers.", "clone_addr": "https://github.com/Julow/Unexpected-Keyboard.git", "mirror": true, "private": false, "uid": "failed", "service": "github", "wiki": true, "auth_token": "redacted"}

I've performed a fresh git clone, replacing only my config.json, but it hasn't helped.

What version of Gitea have you tested this against? If the API has changed, I may need to update my local instance.

Thanks! :)

varunsridharan commented 1 year ago

Hi, Thanks for sharing the details. Please allow me sometime to check for the issue.

varunsridharan commented 1 year ago

if you could share the action log to test then it would be easy to debug more on this.

Jefferderp commented 1 year ago

Hi,

Here is the full output:

https://pastebin.com/raw/FGSsXqkS

varunsridharan commented 1 year ago

@Jefferderp

Thanks for sharing the log. and yes i was able to replicate but not multiple times.

The error was due to Gitea instance was not responding may be due to Database connection error or some system error.

I just restarted the service and it worked perfectly.

I am currently using the latest version of Gitea and our mirror code works good.

you just need to optimize your instance if you are just going to use it just for local mirror of your github account

here is my config

APP_NAME = GitMirror - Personal Github Mirrors
RUN_MODE = dev
RUN_USER = git

# prod
[database]
DB_TYPE  = mysql
HOST     = *****
NAME     = gitea
USER     = gitea
PASSWD   = ***************
SCHEMA   = 
SSL_MODE = disable
CHARSET  = utf8mb4
PATH     = /gitea/data/data/gitea.db
LOG_SQL  = false

# PATH = /gitea/config/gitea.db
[security]
# INSTALL_LOCK       = true
SECRET_KEY         = *************************
INTERNAL_TOKEN     = *************************
PASSWORD_HASH_ALGO = pbkdf2
INSTALL_LOCK       = true

[oauth2]
JWT_SECRET = ********************

[mailer]
ENABLED       = true
FROM          = *****@*****.*****.dev
MAILER_TYPE   = smtp
HOST          = *****.*****.org:465
HELO_HOSTNAME = *****.dev
USER          = *****@*****.**********.dev
PASSWD        = ********************

[picture]
DISABLE_GRAVATAR        = true
ENABLE_FEDERATED_AVATAR = false

[repository]
ROOT           = /gitea/repos
DEFAULT_BRANCH = main

[service]
ALLOW_ONLY_INTERNAL_REGISTRATION = true
DISABLE_REGISTRATION              = true
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = true
REQUIRE_SIGNIN_VIEW               = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = *****.git.*****.dev

[repository.upload]
ENABLED = false

[ui]
EXPLORE_PAGING_NUM  = 25
ISSUE_PAGING_NUM    = 15
MEMBERS_PAGING_NUM  = 25
FEED_MAX_COMMIT_NUM = 10
FEED_PAGING_NUM     = 50

[ui.admin]
REPO_PAGING_NUM = 300

[ui.meta]
AUTHOR      = varunsridharan <**********@gmail.com>
DESCRIPTION = Personal Github Mirror

[time]
DEFAULT_UI_LOCATION = Asia/Kolkata

[mirror]
DEFAULT_INTERVAL = 20m
MIN_INTERVAL     = 5m

[other]
SHOW_FOOTER_BRANDING = false
SHOW_FOOTER_VERSION = false
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
ENABLE_SITEMAP = false
ENABLE_FEED = false

[log]
ROOT_PATH = /gitea/data/log
MODE      = console
LEVEL     = info
ROUTER    = console

[cron.update_mirrors]
SCHEDULE = @every 10m

[server]
SSH_DOMAIN       = git.*****.dev
DOMAIN           = git.*****.dev
HTTP_PORT        = 80
#ROOT_URL         = https://*****/
ROOT_URL         = http://*****/
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /gitea/data/data/lfs
LFS_JWT_SECRET   = *******
OFFLINE_MODE     = true
#USE_PROXY_PROTOCOL = true

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[git.timeout]
DEFAULT = 1200
MIGRATE = 1200
MIRROR = 1200
CLONE = 1200
PULL = 1200
GC = 1200
Jefferderp commented 1 year ago

Thanks so much for looking into this for me. I did suspect that my Gitea instance was to blame. I'll look into updating and optimizing it.