3

I have two servers, an older server running plain git with three repositories under /opt/. These projects are now to be moved over to a new server where I choose to run gitlab for the sake of the GUI and to be able to invite friends to learn programming and have an easier place to view and manage projects.

However, when moving over I want to keep the revisions of my old code bases. Somehow I thought just doing scp -r old-server.net:/opt/project.git /gitlab/ would suffice but this fails.

I navigated to gitlab and created a new repo just to get the folder structure which created a wiki and a code-folder called /gitlab/project.git with the same folder structure as it is on the old server (without the code obviously) and the project loads fine in gitlab, but then i did rm -rf project.git and did the scp ... and now i get a 500 We're sorry, but something went wrong..

My guess is that the revisions and perhaps an URL in the server-folder is wrong, but I can't find anything by going through the files manually or via the docs on gitlab.

Anyone done something similar?

Thank you in advance!

3

Add the new gitlab remote to your existing repository and push:

git remote add gitlab url-to-gitlab-repo

git push gitlab master

2

Often the most simple basic solutions work... permissions, always check your permissions.

chown -R git.git /gitlab/project.git/
1

I assume you have a few repos you want to include on your GitLab instance.

GitLab provides a bulk method to do this. I added about 250 repos with no issues. Copy your git files to a new location on your GitLab server I will use a directory named 'import'. You can add 'XXX' (or even XXX/YYY) if you need sub location within your project:

# Use sudo as needed, but it's important to do this
# using the same username than the final GitLab repo.
rsync -av /your/repo/location/* ./import/XXX
# give GitLab  full access
chown git:git ./ -R
# Later GitLab will modify the source and turn into a bundle
chmod 02777 -R ./*.git
# now the real work. Note that the source is import and not import/XXX
gitlab-rake gitlab:import:repos['./import/']

Now refresh your GitLab gui and the imported projects will be visible. In my case, I have some old hooks, now deprecated on GitLab, so, I bulk deleted all on the newly created git files. (otherwise your will receive an error when pushing).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.