Gitea: feature, bulk importing of repositories

Created on 22 Sep 2017  路  23Comments  路  Source: go-gitea/gitea

Recently i hacked about in the back-end and database to migrate all of our stash repositories and jam these into gitea.

It's not an operation that i'll need to repeat, as far as i can tell in the documentation there's no procedure for doing this sort of thing.

I was thinking, as a feature, it might be handy to have an "upload zip" for migration to facilitate easy migration from other git servers.

I'm sure there're higher priorities, but figured it would make it easier for people to migrate and adopt gitea.

Thanks

kinproposal

Most helpful comment

Such migrations should be done in scripts or external tools but should not be part of main gitea repo

All 23 comments

You can do migrations via API. Write some scripts to do that.

Such migrations should be done in scripts or external tools but should not be part of main gitea repo

Any pointers to valid Github-to-Gitea scripts? I come up empty.

@tacotexmex currently @JonasFranzDEV has a really good one: https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator

Thank you very much @tecknowlogick. * quietly thinking how I could鈥檝e discovered this selfhosted gem without your help, dreaming of a federation of Gitea instances, Mastodon-style *

@tacotexmex you are very welcome. Currently there is a working group that is dedicated to solving the issue of federated services. I actually just spent the morning catching up on discussions from the group. If you want to follow along you can see: https://github.com/git-federation/gitpub/issues/5 Unrelated to federation we have a discord channel where the above tool was posted to.

Such migrations should be done in scripts or external tools but should not be part of main gitea repo

@lafriks why? i think migration should be as simple as possible.

imagine a workflow like this:

  1. login to gitea with github
  2. click "import from github"
  3. select repos you want to import (all selected by default)
  4. wait some seconds (or minutes) ... migration done

if load on the gitea server could be a problem, a queue could be implemented.

@davidak while I agree that it should be as simple as possible but if we implement imports from github/bitbucket/gitlab etc it will be hard keep up with their api changes. There is example that it can be easily done outside of Gitea main code base - https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator

Of course there are few things that we need to implement in Gitea API to have possibility to import more data but that's other thing

Anyone have a mirror or copy of https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator ? The site is throwing a 500 error when trying to either clone the repo locally or even download the source code.

@JonasFranzDev your server has problems ;)

Edit, use at your own risk and don't randomly download zips from the internet.

Cheers guys, thanks 馃槃

https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator is back up and states:

This repository got moved to the offical Gitea server and will be developed there. https://gitea.com/gitea/migrator/

I just tested it, it worked flawlessly (Debian 9/10)

apt update
apt install make golang go-dep git make
go get gitea.com/gitea/migrator
cd go/src/gitea.com/gitea/migrator
dep ensure -v
make build

sudo -u gitea ./gitea-github-migrator migrate --gh-repo my/project --gh-token $GITHUB_PERSONAL_TOKEN --url https://example.com/gitea --token $GITEA_API_TOKEN

Edit: limitation: doesn't import pull requests/release notes. Didn't create the project as "mirror" (no automatic pulls in the future).

Repository, issues, tags, wiki were imported correctly. Operation took 11 minutes on a github project with 1300 issues.

For others coming to this issue, the migration functionality is now built into gitea itself.

@techknowlogick you mean using the + New migration action?

This doesn't import issues/wiki for me, only the git repository.

@nodiscc @techknowlogick is right. You can migrate almost all things from github.

When you input a github URL on migration UI, and put a username/password or token/, then you will find some migrations options displayed, you can check issues/wiki/pull requests/milestones/labels .

Of course you have to have v1.9 or above.

@lunny my bad, I'm on 1.8.0, still have to upgrade. I will definitely try this (my gripe was it didn't set up the repository as _mirror_ and there was no way to change it after the fact).

By the way, thank you and all contributors for the hard work on Gitea. I'm in the process of moving all my projects to a self-hosted Gitea instance (with automatic Github/Gitlab mirrors through hooks), it has been _great_ so far. You can find my ansible role to install gitea here (inspired from [1], [2]).

I think this issue can be closed as bulk import/migration is perfectly doable using https://gitea.com/gitea/migrator/ (which is linked at https://docs.gitea.io/en-us/third-party-tools/) - or one by one from the web interface.

@lunny ping

@nodiscc Currently we can import almost all things of one repository from github, but maybe this issue is importing many repositories on one operation.

I would say this is a feature for tea link: https://gitea.com/gitea/tea/issues/22

PS: when tea reaches v1.0 we can add it to gitea docs as tool to automate/do stuff via CLI ...

Currently the suggested "https://gitea.com/gitea/migrator/" shows:

This tool is no longer maintained and got replaced by the migration functionality in Gitea. 
Please use the "New migration" menu to migrate your GitHub repositories including issues, pullrequests etc.

But "new migration" inside gitea does only migrate a single repository, so this does not help much if one has to migrate hundreds of repos.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adpande picture adpande  路  3Comments

lunny picture lunny  路  3Comments

BNolet picture BNolet  路  3Comments

jonasfranz picture jonasfranz  路  3Comments

haytona picture haytona  路  3Comments