Gitlab Wiki - How to import wiki when importing a repository
Asked Answered
K

3

7

I have a Gitlab CE 11.7 docker running on my server. When I import a project from gitlab.com, its wiki is missing. I use the built-in interface to import the projects:

New Project > Import project [tab] > GitLab.com [button]

then I choose the repository to import from a list of repositories connected to my account.

Is there a way to migrate the wiki of a repository from Gitlab.com to a GitLab CE instance?

Kamilahkamillah answered 28/1, 2019 at 11:34 Comment(0)
M
15

Wikis are repos as well. You can clone a project by doing:

git clone https://gitlab.com/{namespace}/{project}.wiki.git

If you click the "Git Access" link at the top in your wiki, you also get this URL.

Since it is a repo you can then push to the desired destination wiki.

Monophyletic answered 28/1, 2019 at 16:5 Comment(0)
S
8

The valid answer is just what I needed. I still want to share the whole process to get the migration done is a few steps. I have a dedicated git server but you can use http.

git clone  [email protected]:myGroup/myRepo.wiki.git
git remote rename origin oldorigin
git remote add origin [email protected]:myGroup/myRepo.wiki.git
git fetch origin
git push --force

Force is necessary as there will not be common points in the imported history.

Systematism answered 13/8, 2021 at 7:53 Comment(2)
This worked for me except that I needed to cd into the cloned dir after cloning it, and I needed to do this for the push command: "git push origin master --force"Monochord
very nice! I have to add the new origin in the last step. Accidentally pushed to the old wiki - which I had deleted seconds before. "git push --set-upstream origin main"Smokedry
Y
1

As noted in djuarezg's answer

Wikis are repos as well. You can clone a projec

And with GitLab 17.1 (June 2024), you now have an easier and quicker cloning with a new wiki repository clone button.

See Documentation and Issue.

clone wiki -- https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfnZ7-sWV9QWRft/-/project/278964/uploads/dd67bcb7c9c59de282eee00396546d4e/image.png

Yerga answered 23/6, 2024 at 20:50 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.