Import Repositories

The instructions below should help you when you need to import existing Git or Subversion repositories.

For both Git and Subversion import you first need to create a new, empty GitLab project to host the imported repository.


The easiest way is to use Import project from directly when you creating a new project. Choose git Repo by URL to import from another repository available via HTTPS on

To import at a later time or from a repository that is only available over ssh you can run the following commands:

git clone <user>@<repository_url> --mirror </some/local/directory>
cd </some/local/directory>
git remote add gitlab<group>/<project>.git
git push --mirror gitlab


This is the short version of the official guide working with our svn service.

First you need to extract the authors of all commits to a file authors.txt:

svn log<ou>/<repo> --xml | grep author | sort -u | perl -pe 's/.*>(.*?)<.*/$1 = $1 <$1>/' > ./authors.txt

Review this file and delete all lines not of the form login = login <login>. You can also complete the file with the full email addresses of all users.

Clone the repository with history assuming the standard layout and using the authors.txt file created before:

git svn clone<ou>/<repo> --stdlayout  --authors-file=./authors.txt --no-metadata

Now migrate tags and branches to the right places:

cd <repo>
cp -Rf .git/refs/remotes/origin/tags/* .git/refs/tags/
rm -Rf .git/refs/remotes/origin/tags
cp -Rf .git/refs/remotes/origin/* .git/refs/heads/ 
rm -Rf .git/refs/remotes
git branch -d trunk

Finally push the files to the repository:

git remote add origin<group>/<repository>.git
git push origin --all
git push origin --tags

Are these instructions wrong, incomplete or outdated? Are they not helpful?
Please let us know.

Page URL:
© 2022 Eidgenössische Technische Hochschule Zürich