Repository migration between Gitlab instances

Due to my old Gitlab installation, which is too hard to upgrade (Thread on the TKL support forums: http://www.turnkeylinux.org/forum/support/20120913/upgrading-gitlab ), I downloaded the current TKL Gitlab distribution, and the standard one followed Gitlabs update path so that I now have a completely updated Gitlab 6.1 installation working with TKLBAM and all these good stuff. So far so good.

But it turns out that our old version of gitlab does not provide HTTP urls for repositories, so this means that I cannot use the "Import existing repository" function in Gitlab 6.1

I know that I can just copy the old Git repositories from the old VM to the new one, but how can I make these repositories visible in Gitlab on the new VM?

+6
source share
4 answers

One of the options:

  • Clone an old repo from gitlab to a dev machine.
  • Create an empty repo on the new gitlab.
  • Add a new repo as a remote device on the dev machine.
  • We push everything to a new repo.
  • Remove old repo from the list of deleted repositories.

To create a newRepo remote call, do: git remote add newRepo gitlab.localhost.com:User/newRepo.git (replace the URL at the end with one for your repo)

+7
source

I recently switched from gitolit to gitlab, and the official gitlab:import:repos rake task worked for me. I am using gitlab 6.1.0 (82f3446). Here is what I did:

  • rsync naked repositories from githolite to repositories/{group}/ . Be sure to replace {repository} with the name of the gitolite repository and change the host name of your gitlab server.

     rsync -rth --progress repositories/{repository}.git \ git@gitlab-server :/home/git/repositories/{group}/ 

    Here {group} is the name of the user group to which you want to add the repository. If you do not have a specific group, select root as the group name.

  • Fix permissions - only necessary when the rsync user is not git :

     sudo chown -R git:git repositories/{group}/ 
  • cd ~/gitlab

  • Run the rake task to import all new repositories:

     bundle exec rake gitlab:import:repos RAILS_ENV=production 

Now, if you log in as an administrator, you will see that a new project has been added.

For more information, see "Importing bare repositories into an instance of a GitLab project" in http://{your-gitlab-server}/help/raketasks .

In your case, you can log into your old TKL and rsync system all the bare repositories into a new instance, and then import.

+13
source

I did this in the following manner after reading ChrisA's answer, which gave me a little headache on how to do this in practice. The example copies the repository from github to gitlab to make the source and destination a little clearer.

  • Clone an old repo from github to a dev machine (which creates a bare repo):

     $ git clone --mirror git@github.com :me/myrepo.git 
  • Create an empty repo in new gitlab.

  • Add a new repo as a remote device on the dev machine.

     $ cd myrepo.git $ git remote add newRepo git@gitlab.com :me/myrepo.git 
  • Direct everything back to the new repo.

     $ git push --mirror newRepo 

What is it.

Thus, he copied all the branches and tags to the new destination.

Now you can remove the cloned bare repo from your dev machine.

+5
source

If your Gitlab => 8.9, you can use export / import to migrate the repositories.

0
source

Source: https://habr.com/ru/post/954997/


All Articles