Wiki

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated
History
  • Page loading changed to asynchronous in GitLab 14.9.
  • Page slug encoding method changed to ERB::Util.url_encode in GitLab 14.9.

If you don’t want to keep your documentation in your repository, but you want to keep it in the same project as your code, you can use the wiki GitLab provides in each GitLab project. Every wiki is a separate Git repository, so you can create wiki pages in the web interface, or locally using Git.

GitLab wikis support Markdown, Rdoc, AsciiDoc, and Org for content. Wiki pages written in Markdown support all Markdown features, and also provide some wiki-specific behavior for links.

In GitLab 13.5 and later, wiki pages display a sidebar, which you can customize. This sidebar contains a partial list of pages in the wiki, displayed as a nested tree, with sibling pages listed in alphabetical order. To view a list of all pages, select View All Pages in the sidebar:

Wiki sidebar

View a project wiki

To access a project wiki:

  1. On the left sidebar, select Search or go to and find your project.
  2. To display the wiki, either:

If Plan > Wiki is not listed in the left sidebar of your project, a project administrator has disabled it.

Configure a default branch for your wiki

History

The default branch for your wiki repository depends on your version of GitLab:

  • GitLab versions 14.1 and later: Wikis inherit the default branch name configured for your instance or group. If no custom value is configured, GitLab uses main.
  • GitLab versions 14.0 and earlier: GitLab uses master.

For any version of GitLab, you can rename this default branch for previously created wikis.

Create the wiki home page

When a wiki is created, it is empty. On your first visit, you can create the home page users see when viewing the wiki. This page requires a specific title to be used as your wiki’s home page. To create it:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Select Create your first page.
  4. GitLab requires this first page be titled home. The page with this title serves as the front page for your wiki.
  5. Select a Format for styling your text.
  6. Add a welcome message for your home page in the Content section. You can always edit it later.
  7. Add a Commit message. Git requires a commit message, so GitLab creates one if you don’t enter one yourself.
  8. Select Create page.

Create a new wiki page

Users with at least the Developer role can create new wiki pages:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Select New page on this page, or any other wiki page.
  4. Select a content format.
  5. Add a title for your new page. Page titles use special characters for subdirectories and formatting, and have length restrictions.
  6. Add content to your wiki page.
  7. Optional. Attach a file, and GitLab stores it in the wiki’s Git repository.
  8. Add a Commit message. Git requires a commit message, so GitLab creates one if you don’t enter one yourself.
  9. Select Create page.

Create or edit wiki pages locally

Wikis are based on Git repositories, so you can clone them locally and edit them like you would do with every other Git repository. To clone a wiki repository locally:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. On the right sidebar, select Clone repository.
  4. Follow the on-screen instructions.

Files you add to your wiki locally must use one of the following supported extensions, depending on the markup language you wish to use. Files with unsupported extensions don’t display when pushed to GitLab:

  • Markdown extensions: .mdown, .mkd, .mkdn, .md, .markdown.
  • AsciiDoc extensions: .adoc, .ad, .asciidoc.
  • Other markup extensions: .textile, .rdoc, .org, .creole, .wiki, .mediawiki, .rst.

Special characters in page titles

Wiki pages are stored as files in a Git repository, so certain characters have a special meaning:

  • Spaces are converted into hyphens when storing a page.
  • Hyphens (-) are converted back into spaces when displaying a page.
  • Slashes (/) are used as path separators, and can’t be displayed in titles. If you create a title containing / characters, GitLab creates all the subdirectories needed to build that path. For example, a title of docs/my-page creates a wiki page with a path /wikis/docs/my-page.

Length restrictions for file and directory names

History

Many common file systems have a limit of 255 bytes for file and directory names. Git and GitLab both support paths exceeding those limits. However, if your file system enforces these limits, you cannot check out a local copy of a wiki that contains filenames exceeding this limit. To prevent this problem, the GitLab web interface and API enforce these limits:

  • 245 bytes for page titles (reserving 10 bytes for the file extension).
  • 255 bytes for directory names.

Non-ASCII characters take up more than one byte.

While you can still create files locally that exceed these limits, your teammates may not be able to check out the wiki locally afterward.

Edit a wiki page

You need at least the Developer role to edit a wiki page:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the page you want to edit, and either:
  4. Edit the content.
  5. Select Save changes.

Unsaved changes to a wiki page are preserved in local browser storage to prevent accidental data loss.

Create a table of contents

To generate a table of contents from a wiki page’s subheadings, use the [[_TOC_]] tag. For an example, read Table of contents.

Delete a wiki page

Prerequisites:

  • You must have at least the Developer role.
  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the page you want to delete.
  4. Select the edit icon ( ).
  5. Select Delete page.
  6. Confirm the deletion.

Move a wiki page

Prerequisites:

  • You must have at least the Developer role.
  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the page you want to move.
  4. Select the edit icon ( ).
  5. Add the new path to the Title field. For example, if you have a wiki page called about under company and you want to move it to the wiki’s root, change the Title from about to /about.
  6. Select Save changes.

Export a wiki page

History

You can export a wiki page as a PDF file:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the page you want to export.
  4. Select the vertical ellipsis ( ), and then select Print as PDF.

A PDF of the wiki page is created.

Wiki page templates

History

You can create templates to use when creating new pages, or to apply to existing pages. Templates are wiki pages that are stored in the templates/ directory in the wiki repository.

Create a template

Prerequisites:

  • You must have at least the Developer role.
  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. On the right sidebar, select Templates.
  4. Select New Template.
  5. Enter template title, format and content, as if creating a regular wiki page.

Templates of a particular format can only be applied to pages of the same format. For example, Markdown templates only apply to Markdown pages.

Apply a template

When you are creating or editing a wiki page, you can apply a template.

Prerequisites:

  • You must have created at least one template already.
  1. In the Content section, select the Choose a template dropdown list.
  2. Select a template from the list. If the page already has some content, a warning displays indicating that the existing content will be overridden.
  3. Select Apply template.

View history of a wiki page

The changes of a wiki page over time are recorded in the wiki’s Git repository. The history page shows:

Wiki page history

  • The revision (Git commit SHA) of the page.
  • The page author.
  • The commit message.
  • The last update.
  • Previous revisions, by selecting a revision number in the Page version column.

To view the changes for a wiki page:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the page you want to view history for.
  4. Select Page history.

View changes between page versions

History

You can see the changes made in a version of a wiki page, similar to versioned diff file views:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. Go to the wiki page you’re interested in.
  4. Select Page history to see all page versions.
  5. Select the commit message in the Changes column for the version you’re interested in.

    Wiki page changes

Track wiki events

History

GitLab tracks wiki creation, deletion, and update events. These events are displayed on these pages:

Commits to wikis are not counted in repository analytics.

Customize sidebar

History
  • Introduced in GitLab 13.8, the sidebar can be customized by selecting the Edit sidebar button.

Prerequisites:

  • You must have at least the Developer role.

This process creates a wiki page named _sidebar which fully replaces the default sidebar navigation:

  1. On the left sidebar, select Search or go to and find your project or group.
  2. Select Plan > Wiki.
  3. In the upper-right corner of the page, select Edit sidebar.
  4. When complete, select Save changes.

A _sidebar example, formatted with Markdown:

### [Home](home)

- [Hello World](hello)
- [Foo](foo)
- [Bar](bar)

---

- [Sidebar](_sidebar)

Enable or disable a project wiki

Wikis are enabled by default in GitLab. Project administrators can enable or disable a project wiki by following the instructions in Sharing and permissions.

Administrators for self-managed GitLab installs can configure additional wiki settings.

You can disable group wikis from the group settings

To add a link to an external wiki from a project’s left sidebar:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Settings > Integrations.
  3. Select External wiki.
  4. Add the URL to your external wiki.
  5. Optional. Select Test settings.
  6. Select Save changes.

You can now see the External wiki option from your project’s left sidebar.

When you enable this integration, the link to the external wiki doesn’t replace the link to the internal wiki. To hide the internal wiki from the sidebar, disable the project’s wiki.

To hide the link to an external wiki:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Settings > Integrations.
  3. Select External wiki.
  4. Under Enable integration, clear the Active checkbox.
  5. Select Save changes.

Disable the project’s wiki

To disable a project’s internal wiki:

  1. On the left sidebar, select Search or go to and find your project.
  2. Select Settings > General.
  3. Expand Visibility, project features, permissions.
  4. Scroll down to find and turn off the Wiki toggle (in gray).
  5. Select Save changes.

The internal wiki is now disabled, and users and project members:

  • Cannot find the link to the wiki from the project’s sidebar.
  • Cannot add, delete, or edit wiki pages.
  • Cannot view any wiki page.

Previously added wiki pages are preserved in case you want to re-enable the wiki. To re-enable it, repeat the process to disable the wiki but toggle it on (in blue).

Rich text editor

History

GitLab provides a WYSIWYG editing experience for GitLab Flavored Markdown in wikis.

Support includes:

  • Formatting text, including using bold, italics, block quotes, headings, and inline code.
  • Formatting ordered lists, unordered lists, and checklists.
  • Creating and editing table structure.
  • Inserting and formatting code blocks with syntax highlighting.
  • Previewing Mermaid, PlantUML, and Kroki diagrams (introduced in GitLab 15.2).
  • Creating and editing HTML comments (introduced in GitLab 15.7).

Use the rich text editor

  1. Create a new wiki page, or edit an existing one.
  2. Select Markdown as your format.
  3. Above Content, select Edit rich text.
  4. Customize your page’s content using the various formatting options available in the rich text editor.
  5. Select Create page for a new page, or Save changes for an existing page.

The rich text editing mode remains the default until you switch back to edit the raw source.

Switch back to the old editor

  1. If you’re editing the page in the rich text editor, scroll to Content.
  2. Select Edit source.

GitLab Flavored Markdown support

Supporting all GitLab Flavored Markdown content types in the rich text editor is a work in progress. For the status of the ongoing development for CommonMark and GitLab Flavored Markdown support, read:

Troubleshooting

Page slug rendering with Apache reverse proxy

In GitLab 14.9 and later, page slugs are now encoded using the ERB::Util.url_encode method. If you use an Apache reverse proxy, you can add a nocanon argument to the ProxyPass line of your Apache configuration to ensure your page slugs render correctly.

Recreate a project wiki with the Rails console

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated
caution
This operation deletes all data in the wiki.
caution
Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.

To clear all data from a project wiki and recreate it in a blank state:

  1. Start a Rails console session.
  2. Run these commands:

    # Enter your project's path
    p = Project.find_by_full_path('<username-or-group>/<project-name>')
    
    # This command deletes the wiki project from the filesystem.
    p.wiki.repository.remove
    
    # Refresh the wiki repository state.
    p.wiki.repository.expire_exists_cache
    

All data from the wiki has been cleared, and the wiki is ready for use.