GitLab Wikis and Snippets
GitLab Wikis give teams a built-in place to write project documentation. Snippets are a separate tool for storing and sharing small pieces of reusable code without creating a full project.
What Is a Wiki?
A wiki is a collection of pages inside your project where you write documentation using Markdown. Unlike a README — which is a single file — a wiki can grow into dozens of pages with a sidebar for navigation.
Project Wiki Structure ────────────────────── Home ├── Getting Started │ ├── Installation Guide │ └── Configuration Options ├── API Reference │ ├── Authentication │ └── Endpoints └── Troubleshooting
Enabling and Accessing the Wiki
Wikis are enabled by default. Access yours at Project → Plan → Wiki. If the Wiki menu item is missing, an Owner or Maintainer has disabled it at Settings → General → Visibility → Wiki.
Creating Your First Wiki Page
Click Create your first page on the empty wiki. Enter a page title — this becomes part of the URL. Write content using Markdown. Click Create page to save.
Page title: Installation Guide URL becomes: gitlab.com/acme/project/-/wikis/installation-guide Content (Markdown): ## Requirements - Node.js 18 or higher - PostgreSQL 14 ## Steps 1. Clone the repository 2. Run `npm install` 3. Copy `.env.example` to `.env`
Formatting Wiki Pages
GitLab wikis support Markdown, AsciiDoc, and reStructuredText. Markdown is the simplest choice for most teams.
| Markdown Syntax | Result |
|---|---|
| ## Heading | Large heading |
| **bold text** | bold text |
| `inline code` | Highlighted code word |
| [Link text](URL) | Clickable hyperlink |
|  | Embedded image |
| [[Another Page]] | Internal wiki link |
Internal Wiki Links
Use double brackets to link between wiki pages:
[[Installation Guide]] → links to the Installation Guide page [[API/Authentication]] → links to a nested page
GitLab renders these as clickable links and shows them in a related pages panel.
The Wiki Sidebar
Add a page named _sidebar to create a custom navigation sidebar that appears on every wiki page.
_sidebar page content: ────────────────────── **Getting Started** - [[Installation Guide]] - [[Configuration Options]] **Reference** - [[API Authentication]] - [[Endpoints]]
Wiki Version History
Every save creates a version. Click Page history on any wiki page to see all past versions, who made each change, and when. Click any version to read it. Click Compare to see exactly what changed between two versions.
Installation Guide — Page History ───────────────────────────────────────────── v5 Sara "Add Docker instructions" today v4 Arjun "Fix typo in step 3" 2 days ago v3 Riya "Add screenshots" 1 week ago v2 Arjun "Expand requirements list" 2 weeks ago v1 Sara "Initial page" 1 month ago
Cloning the Wiki as a Git Repository
The wiki is itself a Git repository. Clone it to edit pages locally in your preferred text editor:
git clone git@gitlab.com:acme/project.wiki.git Edit pages → git add . → git commit -m "Update API docs" → git push
Changes pushed to the wiki repo appear instantly in the GitLab interface.
What Are Snippets?
A snippet is a small piece of code you want to save and share, without needing a full project. Use snippets for reusable scripts, config templates, one-liners, or code examples.
Use case examples: ───────────────────────────────────────────────────── ✅ A bash script that backs up a database ✅ An nginx config template your team reuses ✅ A Python one-liner for parsing JSON ✅ A SQL query you run every Monday ❌ An entire application (use a project instead)
Project Snippets vs Personal Snippets
| Type | Location | Visible To |
|---|---|---|
| Project snippet | Inside a specific project | Project members |
| Personal snippet | Your profile (gitlab.com/-/snippets) | Public, internal, or private (your choice) |
Creating a Snippet
Click + in the top navigation bar and choose New snippet. Add a title, choose the file name and language, paste your code, and set visibility. GitLab applies syntax highlighting automatically based on the file extension.
Title: PostgreSQL backup script Filename: backup.sh Language: Shell (auto-detected from .sh) Visibility: Internal #!/bin/bash pg_dump mydb > backup_$(date +%F).sql echo "Backup complete"
Multi-File Snippets
A single snippet can contain multiple files. Click Add another file when creating or editing a snippet. This is useful for a config file and its corresponding README, for example.
Sharing and Embedding Snippets
Every snippet has a unique URL you can share. Public snippets also provide an embed code — a short script tag you paste into any webpage to display the snippet with syntax highlighting.
Snippet URL: gitlab.com/-/snippets/1234567 Embed code: <script src="https://gitlab.com/-/snippets/1234567.js"></script>
