58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
GitLab-to-Gitea Import Tools
|
|
============================
|
|
|
|
I knocked these together while migrating from a self-hosted GitLab CE
|
|
instance to a self-hosted Gitea instance. It should also prove useful for
|
|
migrating from gitlab.com. It is aimed mainly at batch-migrating
|
|
repositories for a single user, but admins could extend it to migrate
|
|
repositories for all users.
|
|
|
|
config.sh
|
|
---------
|
|
|
|
Set your GitLab and Gitea URLs, usernames, and access tokens here.
|
|
|
|
list-gitlab-projects.sh
|
|
-----------------------
|
|
|
|
This pulls a list of projects owned by the account associated with the
|
|
access token. Remove "&owned=true" for all projects on the instance...this
|
|
might be useful on a self-hosted GitLab, but probably should be left in
|
|
place for gitlab.com. :)
|
|
|
|
You might find it useful to filter the output to get just the repo names:
|
|
|
|
```./list-gitlab-projects.sh | sed "s/.*\///;s/\.git//" >repos.txt```
|
|
|
|
import.sh
|
|
---------
|
|
|
|
This fires off a request through the Gitea API to migrate a repository from
|
|
GitLab. It takes two arguments:
|
|
|
|
* repo name
|
|
* private flag (will import as a private repo unless this is set to
|
|
```false```)
|
|
|
|
You might want to call this from a script that batches up all your imports
|
|
together.
|
|
|
|
get-gitlab-container-repos.sh
|
|
-----------------------------
|
|
|
|
This pulls a list of container image tags within your repositories. Once
|
|
you have this list, it's trivial to script up a ```docker image
|
|
pull```/```docker image push``` loop to transfer the images.
|
|
|
|
This script requires [jq](https://github.com/jqlang/jq) for some JSON
|
|
filtering. Your Linux distro probably has it. (Arch does, at least.)
|
|
|
|
delete-gitea-projects.sh
|
|
------------------------
|
|
|
|
This is supposed to remove all projects in your Gitea account, but I found
|
|
that it might need to be run several times before it completely clears out
|
|
your account. It worked well enough for me to not have to wipe out the
|
|
entire Gitea instance and start over. Depending on your circumstances, you
|
|
might not need it.
|