Hi, how can we migrate our non bare gitlab repos to svn. since on a bare repo i can not commit or push anything. I
SubGit supports only bare Git repositories, working copies are not supported. Bare repositories don’t allow working with them directly, indeed, but it is possible to clone a bare repository to a working copy and work then with the copy using the bare repository as a “remote”.
The repositories on a GitLab server are actually bare repositories and SubGit is supposed to be installed on the GitLab server and work directly with the bare repositories on the server. Here is the documentation article that describes SubGit setup for GitLab server:
It describes SVN to GitLab migration, but the opposite direction is also possible. For that you will need to create a new and empty SVN repository (with no revisions) and configure the repository URL and the SVN URL for a SubGit setup, here are the steps:
create empty Subversion repository:
svnadmin create svnRepos
prepare the Git repository for the mirroring:
subgit configure --svn-url <SVN_URL> <GIT_REPO>
SVN_URL here stands for the newly created SVN repository URL and GIT_REPO is the GitLab project filesystem path.
provide valid SVN credentials that SubGit will use to connect the SVN repository.
There are several methods for that:
the easiest way is to provide a username/password pair (or pairs) in <GIT_REPO>/subgit/passwd file.
- provide an authors mapping so that SubGit is able to set correct author name in SVN:
again, the easiest way is to fulfill <GIT_REPO>/subgit/authors.txt file with the correct mapping.
establish the mirror:
subgit install <GIT_REPO>
If, however, you mean GitLab cloud and not on-premise GitLab server, then the GitLab repository should be cloned as a bare repository:
git clone --mirror <REPO URL> <LOCAL REPO>
And then the cloned bare repository can be imported to SVN using the steps above. Note, however, that in this case changes from SVN won’t be sent to GitLab cloud and only the cloned bare repository will be in sync with SVN.