Migrate repository Gitea to another Gitea server #12652

Closed
opened 2025-11-02 10:17:12 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @mangeMelon on GitHub (Mar 15, 2024).

Description

https://forum.gitea.com/t/migrate-repository-gitea-to-another-gitea-server/8761?u=mlebon
Hello community,

OLD SERVER debian 11 gitea 1.19.4 -> gitea 1.21.7 mariadb Ver 15.1 Distrib 10.5.19-MariaDB nginx
NEW SERVER debian 12 gitea 1.21.7 mariadb Ver 15.1 Distrib 10.11.6-MariaDB

My two systems communicate PING and SSH in both directions, and they are both self-hosted.

As part of a proof of concept I set up a Gitea server.
Due to availability issues, this POC had to be functional.

Today I was able to configure a new Gitea server.
I therefore want to transfer part of the deposits to the new server while maintaining the pull-request issues.

I see that in "new migration" the choice of gitea is available.
I made several attempts without success, I tried with or without access token, mirror, LFS...

For the token I created it using the web interface of the old server
profile -> configuration -> application
I put a name and check all the permissions

Here is my installation procedure:
So I use the migration tools
selection Gitea.
I put the URL of the repository that I want imported
I fill in with an access token that I created
I check the element labels tickets requests for addition, publication, milestone
I select the new owner
fill in the name of the repository
and press migrate

and I get the following message

You cannot import from disallowed hosts, please ask the admin to check ALLOWED_DOMAINS/ALLOW_LOCALNETWORKS/BLOCKED_DOMAINS settings.

The configuration of the app.ini file is similar for both servers, I tried several configurations

; [migrations]
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; ; Max attempts per http/https request on migrations.
; MAX_ATTEMPTS = 3
; ;
; ; Backoff time per http/https request retry (seconds)
; RETRY_BACKOFF = 3
; ;
; ; Allowed domains for migrating, default is blank. Blank means everything will be allowed.
; ; Multiple domains could be separated by commas.
; ; Wildcard is supported: "github.com, *.github.com"
; ALLOWED_DOMAINS =
ALLOWED_DOMAINS = *.MY.DOMAIN*
; ;
; ; Blocklist for migrating, default is blank. Multiple domains could be separated by commas.
; ; When ALLOWED_DOMAINS is not blank, this option has a higher priority to deny domains.
; ; Wildcard is supported.
BLOCKED_DOMAINS =
; ;
; ; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default)
; ; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored.
; ALLOW_LOCALNETWORKS = false
ALLOW_LOCALNETWORKS = true

New server log

mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/events for MY_IP:PORT, 200 OK in 223873.0ms @ events/events.go:18(events.Events)
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:231:remove() [T] Done 65f19cb2-2: GET: /user/events
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:188:Add() [T] Start 65f19d92: POST: /repo/migrate (request)
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:47:func1() [T] router: started   POST /repo/migrate for IP:63909
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:50:SessionUser() [T] Session Authorization: Found user[3]
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:66:SessionUser() [T] Session Authorization: Logged in user <User 3:MYUSER>
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 .../context_response.go:68:HTML() [D] Template: repo/migrate/gitea
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:102:func1() [I] router: completed POST /repo/migrate for MY_IP:PORT, 200 OK in 18.2ms @ repo/migrate.go:151(repo.MigratePost)
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:231:remove() [T] Done 65f19d92: POST: /repo/migrate
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:188:Add() [T] Start 65f19d92-2: GET: /user/events (request)
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:47:func1() [T] router: started   GET /user/events for IP:63909
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:50:SessionUser() [T] Session Authorization: Found user[3]
mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:66:SessionUser() [T] Session Authorization: Logged in user <User 3:MYUSER>
mars 13 13:35:34 NEW_SERVER gitea[62215]: 2024/03/13 13:35:34 ...eb/routing/logger.go:68:func1() [I] router: polling   GET /user/events for MY_IP:PORT, elapsed 3931.3ms @ events/events.go:18(events.Events)
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f: Cron: Stop zombie tasks (normal)
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f-2: Cron: Update Mirrors (normal)
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...ces/mirror/mirror.go:41:Update() [T] Doing: Update
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f-3: Cron: Start schedule tasks (normal)
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f: Cron: Stop zombie tasks
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...ces/mirror/mirror.go:118:Update() [T] Finished: Update: 0 pull mirrors and 0 push mirrors queued
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f-2: Cron: Update Mirrors
mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f-3: Cron: Start schedule tasks

While searching on the net I came across solutions consisting of dumping the database and copying the directory /var/lib/gitea

if possible I would prefer to be able to migrate the repositories

Screenshots

errorMigration

Gitea Version

1.21.7

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

debian 12

Browser Version

chrome Version 122.0.6261.113, firefox

Originally created by @mangeMelon on GitHub (Mar 15, 2024). ### Description https://forum.gitea.com/t/migrate-repository-gitea-to-another-gitea-server/8761?u=mlebon Hello community, OLD SERVER debian 11 gitea 1.19.4 -> gitea 1.21.7 mariadb Ver 15.1 Distrib 10.5.19-MariaDB nginx NEW SERVER debian 12 gitea 1.21.7 mariadb Ver 15.1 Distrib 10.11.6-MariaDB My two systems communicate PING and SSH in both directions, and they are both self-hosted. As part of a proof of concept I set up a Gitea server. Due to availability issues, this POC had to be functional. Today I was able to configure a new Gitea server. I therefore want to transfer part of the deposits to the new server while maintaining the pull-request issues. I see that in "new migration" the choice of gitea is available. I made several attempts without success, I tried with or without access token, mirror, LFS... For the token I created it using the web interface of the old server profile -> configuration -> application I put a name and check all the permissions Here is my installation procedure: So I use the migration tools selection Gitea. I put the URL of the repository that I want imported I fill in with an access token that I created I check the element labels tickets requests for addition, publication, milestone I select the new owner fill in the name of the repository and press migrate and I get the following message ``` You cannot import from disallowed hosts, please ask the admin to check ALLOWED_DOMAINS/ALLOW_LOCALNETWORKS/BLOCKED_DOMAINS settings. ``` The configuration of the app.ini file is similar for both servers, I tried several configurations ``` ; [migrations] ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; ; Max attempts per http/https request on migrations. ; MAX_ATTEMPTS = 3 ; ; ; ; Backoff time per http/https request retry (seconds) ; RETRY_BACKOFF = 3 ; ; ; ; Allowed domains for migrating, default is blank. Blank means everything will be allowed. ; ; Multiple domains could be separated by commas. ; ; Wildcard is supported: "github.com, *.github.com" ; ALLOWED_DOMAINS = ALLOWED_DOMAINS = *.MY.DOMAIN* ; ; ; ; Blocklist for migrating, default is blank. Multiple domains could be separated by commas. ; ; When ALLOWED_DOMAINS is not blank, this option has a higher priority to deny domains. ; ; Wildcard is supported. BLOCKED_DOMAINS = ; ; ; ; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default) ; ; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored. ; ALLOW_LOCALNETWORKS = false ALLOW_LOCALNETWORKS = true ``` New server log ``` mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/events for MY_IP:PORT, 200 OK in 223873.0ms @ events/events.go:18(events.Events) mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:231:remove() [T] Done 65f19cb2-2: GET: /user/events mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:188:Add() [T] Start 65f19d92: POST: /repo/migrate (request) mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:47:func1() [T] router: started POST /repo/migrate for IP:63909 mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:50:SessionUser() [T] Session Authorization: Found user[3] mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:66:SessionUser() [T] Session Authorization: Logged in user <User 3:MYUSER> mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 .../context_response.go:68:HTML() [D] Template: repo/migrate/gitea mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:102:func1() [I] router: completed POST /repo/migrate for MY_IP:PORT, 200 OK in 18.2ms @ repo/migrate.go:151(repo.MigratePost) mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:231:remove() [T] Done 65f19d92: POST: /repo/migrate mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...s/process/manager.go:188:Add() [T] Start 65f19d92-2: GET: /user/events (request) mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...eb/routing/logger.go:47:func1() [T] router: started GET /user/events for IP:63909 mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:50:SessionUser() [T] Session Authorization: Found user[3] mars 13 13:35:30 NEW_SERVER gitea[62215]: 2024/03/13 13:35:30 ...ices/auth/session.go:66:SessionUser() [T] Session Authorization: Logged in user <User 3:MYUSER> mars 13 13:35:34 NEW_SERVER gitea[62215]: 2024/03/13 13:35:34 ...eb/routing/logger.go:68:func1() [I] router: polling GET /user/events for MY_IP:PORT, elapsed 3931.3ms @ events/events.go:18(events.Events) mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f: Cron: Stop zombie tasks (normal) mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f-2: Cron: Update Mirrors (normal) mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...ces/mirror/mirror.go:41:Update() [T] Doing: Update mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:188:Add() [T] Start 65f19d9f-3: Cron: Start schedule tasks (normal) mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f: Cron: Stop zombie tasks mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...ces/mirror/mirror.go:118:Update() [T] Finished: Update: 0 pull mirrors and 0 push mirrors queued mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f-2: Cron: Update Mirrors mars 13 13:35:43 NEW_SERVER gitea[62215]: 2024/03/13 13:35:43 ...s/process/manager.go:231:remove() [T] Done 65f19d9f-3: Cron: Start schedule tasks ``` While searching on the net I came across solutions consisting of dumping the database and copying the directory /var/lib/gitea if possible I would prefer to be able to migrate the repositories ### Screenshots ![errorMigration](https://github.com/go-gitea/gitea/assets/143205113/0c1af05d-5fa3-461e-ba73-f860f537f081) ### Gitea Version 1.21.7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Operating System debian 12 ### Browser Version chrome Version 122.0.6261.113, firefox
GiteaMirror added the topic/uiissue/not-a-bug labels 2025-11-02 10:17:12 -06:00
Author
Owner

@eeyrjmr commented on GitHub (Mar 15, 2024):

So two things.

  1. Migration approach
    The image highlights a protection mechanism that exists as a precaution.
    On the new machine app.ini, set ALLOW_LOCALNETWORKS = true
    https://docs.gitea.com/next/administration/config-cheat-sheet#migrations-migrations

  2. backup-restore.
    Since you own both machines and have filesystem access, a dump and restore might be a quicker method.
    https://docs.gitea.com/next/administration/backup-and-restore

@eeyrjmr commented on GitHub (Mar 15, 2024): So two things. 1. Migration approach The image highlights a protection mechanism that exists as a precaution. On the new machine app.ini, set **ALLOW_LOCALNETWORKS = true** https://docs.gitea.com/next/administration/config-cheat-sheet#migrations-migrations 2. backup-restore. Since you own both machines and have filesystem access, a dump and restore might be a quicker method. https://docs.gitea.com/next/administration/backup-and-restore
Author
Owner

@Dev-Wiki commented on GitHub (Aug 19, 2024):

So two things.

  1. Migration approach
    The image highlights a protection mechanism that exists as a precaution.
    On the new machine app.ini, set ALLOW_LOCALNETWORKS = true
    https://docs.gitea.com/next/administration/config-cheat-sheet#migrations-migrations
  2. backup-restore.
    Since you own both machines and have filesystem access, a dump and restore might be a quicker method.
    https://docs.gitea.com/next/administration/backup-and-restore

设置了 ALLOW_LOCALNETWORKS = true 仍然不行:

[migrations]
ALLOWED_DOMAINS = 
ALLOW_LOCALNETWORKS = true
SKIP_TLS_VERIFY = true
BLOCKED_DOMAINS = 
@Dev-Wiki commented on GitHub (Aug 19, 2024): > So two things. > > 1. Migration approach > The image highlights a protection mechanism that exists as a precaution. > On the new machine app.ini, set **ALLOW_LOCALNETWORKS = true** > https://docs.gitea.com/next/administration/config-cheat-sheet#migrations-migrations > 2. backup-restore. > Since you own both machines and have filesystem access, a dump and restore might be a quicker method. > https://docs.gitea.com/next/administration/backup-and-restore 设置了 ALLOW_LOCALNETWORKS = true 仍然不行: ```ini [migrations] ALLOWED_DOMAINS = ALLOW_LOCALNETWORKS = true SKIP_TLS_VERIFY = true BLOCKED_DOMAINS = ```
Author
Owner

@Dev-Wiki commented on GitHub (Aug 19, 2024):

经测试,ALLOWED_DOMAINS 设置为空不行, 必须设置具体的域名才可以

[migrations]
ALLOWED_DOMAINS = 
ALLOW_LOCALNETWORKS = true
SKIP_TLS_VERIFY = true
BLOCKED_DOMAINS = 
@Dev-Wiki commented on GitHub (Aug 19, 2024): 经测试,ALLOWED_DOMAINS 设置为空不行, 必须设置具体的域名才可以 ```ini [migrations] ALLOWED_DOMAINS = ALLOW_LOCALNETWORKS = true SKIP_TLS_VERIFY = true BLOCKED_DOMAINS = ```
Author
Owner

@Dev-Wiki commented on GitHub (Aug 20, 2024):

经测试,ALLOWED_DOMAINS 设置为空不行, 必须设置具体的域名才可以

[migrations]
ALLOWED_DOMAINS = 
ALLOW_LOCALNETWORKS = true
SKIP_TLS_VERIFY = true
BLOCKED_DOMAINS = 

set ALLOWED_DOMAINS = * problem resolved

@Dev-Wiki commented on GitHub (Aug 20, 2024): > 经测试,ALLOWED_DOMAINS 设置为空不行, 必须设置具体的域名才可以 > > ```ini > [migrations] > ALLOWED_DOMAINS = > ALLOW_LOCALNETWORKS = true > SKIP_TLS_VERIFY = true > BLOCKED_DOMAINS = > ``` set `ALLOWED_DOMAINS = *` problem resolved
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12652