Skip to content

Usage

This guide will help you get GitLab Knowledge Graph up and running on your first project in just a few minutes.

  • GitLab Knowledge Graph installed
  • A workspace folder with an initialized Git repository

The simplest way to start is by indexing a single repository or workspace folder.

Navigate to your project directory and run:

Terminal window
gkg index

This will:

  1. Discover all Git repositories in the current directory
  2. Parse and analyze the code structure
  3. Store the results in a local graph database
  4. Display progress and completion statistics

You can also specify a path to index:

Terminal window
gkg index /path/to/your/workspace
Terminal window
$ gkg index my-project
Workspace indexing completed in 12.34 seconds
Workspace Statistics:
- Projects indexed: 3
- Files processed: 1,247
- Code entities extracted: 5,832
- Relationships found: 12,156

For more advanced usage, you can start GitLab Knowledge Graph in server mode:

Terminal window
gkg server start

The server will start on http://localhost:27495 by default. You will see output like this:

Terminal window
INFO http_server: HTTP server listening on 127.0.0.1:27495

Open your web browser and navigate to http://localhost:27495 to access the GitLab Knowledge Graph web interface. From here you can:

  • View indexed workspaces and projects
  • Browse the knowledge graph visually
  • Search for code entities and relationships
  • Monitor indexing progress in real-time

For more information on the server, see the gkg server command.

As your codebase evolves, you may need to remove workspaces or projects from the Knowledge Graph.

To remove an entire workspace and all its projects:

Terminal window
gkg remove --workspace /path/to/your/workspace

To remove just one project from a workspace:

Terminal window
gkg remove --project /path/to/project --workspace-folder /path/to/workspace

You can also manage workspaces and projects through the web interface:

  1. Hover over a workspace or project in the sidebar
  2. Click the actions menu (three dots)
  3. Select “Delete Workspace” or “Delete Project”

For more details, see the gkg remove command documentation.

GitLab Knowledge Graph integrates with your IDE. See IDE Integration for details.