Mike's Gitea Repo Migrator
Just a script to help make it a little easier to migrate an entire organization (with bulk selection) from one Gitea instance to another.
Supports changing destination names a bit, and adding topics to each transferred repo, as well as optional bulk-selected deletion from the source.
by Mike Peralta
Current license: You are free to clone and use this program but all other rights reserved, provided you accept 100% of all liability of any outcome of use/download/etc. this program. Better license coming soon.
Requirements
- python 3.14.2
- pipenv
Installation
-
Clone this repo and
cdto its root directory -
Execute
pipenv install(and optionally check withpipenv check)
Execution
Ask pipenv to execute main.py on your behalf with the following:
$ cd /path/to/gitea-repo-migrator
$ pipenv run python ./main.py --help
Optionally ask for a shell to run multiple times a bit faster:
$ cd /path/to/gitea-repo-migrator
$ pipenv shell
$ python ./main.py --help
$ python ./main.py --help
App Tokens
You'll need to generate an Application Token for both the source and destination servers, and pass the token along to the command line.
SSL/TLS Verification
You can disable SSL/TLS verification (risky) in the following ways:
- Pass the long switch
--no-verify-sslto completely disable SSL/TLS verification. - Pass the switch
--no-verify-source-sslto disable certificate verification for the source server. - Pass the switch
--no-verify-destination-sslto disable certificate verification for the destination server.
Also, I believe the newer version of urllib3 is either buggy or restricts self-signed CA/chains, as it wasn't working with mine. I had to put something in Pipfile to limit the urllib3 version to less than version 2.4:
urllib3 = "<2.4"
One test I forgot to disable was that I also added my intemediary Web CA certificate into the system certs directory, so I was unable to narrow down whether that contributed to success, or if it was only the older version of urllib3. When I run this program next, I might want to remove the intermediate cert from /usr/local/share/ca-certificates and rebuild to see if it still works.
Destination Repo Names
You can tweak the destination repo names a bit by using a string that includes %N% somewhere. The string %N% will expand to the original name. For example, if we use a repo originally named my-test-repo with the string what-%N%, the resulting destination repo name will be what-my-test-repo. This string will be recomputed for every migrated repo.
Destination Topics
Topics will be duplicated from all source repos to their corresponding destination repos. You can specify additional topics with the --destination-topic switch. For example, to add the topic migrated to every repo, pass the switch --destination-topic migrated.