16

Recently, i found a Gitlab alternative called Gogs.

Any suggestion for migrating repo in Gitlab to Gogs? I m not expecting all of it of course, just as much as possible.

Suriyaa
  • 2,222
  • 2
  • 25
  • 44
Wonson
  • 570
  • 7
  • 15

2 Answers2

16

The correct steps for mirroring a repo is:

$ git clone --mirror git@example.com/upstream-repository.git
$ cd upstream-repository.git
$ git push --mirror git@example.com/new-location.git

Note: Do not use git push --mirror if you did not clone the repo with git clone --mirror. Also, git clone --mirror is preferred over git clone --bare as it will clone all git notes and attributes as well.

Reference: http://blog.plataformatec.com.br/2013/05/how-to-properly-mirror-a-git-repository/

pobzeb
  • 161
  • 1
  • 4
10

Clone localy the bare git repo (=server side repo) and push it as a mirror to new repo:

git clone --bare http://my.gitlab.project.git
cd project.git
git push --mirror http://my.gogs.project.git

This will push all your commits, branches, tags etc. This will work for any git repo, whatever it's hosted on gitlab, gog, github, etc.

Pierre
  • 2,552
  • 5
  • 26
  • 47
  • 1
    Take care! git push --all will NOT push tags! You have to add git push --follow-tags as well! – rralf Apr 14 '16 at 09:33
  • 1
    Yes good remarks ! That's why I've edited the answer with the clone --bare and the push --mirror – Pierre Apr 14 '16 at 09:34