Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sourcegraph/docs/llms.txt

Use this file to discover all available pages before exploring further.

Sourcegraph is available as a fully managed cloud service or as a self-hosted deployment on your own infrastructure. This guide walks you through both paths.

Sourcegraph Cloud

Managed, single-tenant instance hosted by Sourcegraph. No infrastructure required.

Self-hosted

Deploy on your own infrastructure using Docker Compose or Kubernetes.

Sourcegraph Cloud

Sourcegraph Cloud gives you a dedicated, single-tenant instance that Sourcegraph hosts, manages, and upgrades on your behalf. It’s the fastest way to get your team up and running.

Sign up and request an instance

1

Request a Cloud instance

Visit sourcegraph.com and start a free trial. Sourcegraph will provision a dedicated instance for your organization at a URL like your-org.sourcegraph.com.
2

Sign in as site admin

After your instance is provisioned, sign in with the admin credentials provided during setup. The first user to sign in becomes the site administrator.
3

Connect your code hosts

Navigate to Site Admin → Manage code hosts → Add code host and connect your repositories. Sourcegraph supports:
Connect GitHub.com or GitHub Enterprise. You can authenticate using a GitHub App (recommended) or a personal access token.
  1. Go to Site Admin → Manage code hosts → Add code host
  2. Select GitHub
  3. Follow the prompts to install the Sourcegraph GitHub App into your organization, or enter a personal access token with repo and read:org scopes
  4. Configure which repositories to sync (all repos, selected repos, or repos matching a pattern)
See the GitHub code host docs for full configuration options.
You can connect multiple code hosts to the same Sourcegraph instance. Sourcegraph will search across all of them simultaneously.
4

Wait for repositories to sync

After connecting a code host, Sourcegraph begins cloning and indexing your repositories. You can monitor sync progress at Site Admin → Repositories. Indexing time varies based on the number and size of repositories.
5

Run your first search

Navigate to the Sourcegraph home page and enter a search query in the search box. Some examples to try:
# Find all uses of a function across all repos
myCriticalFunction

# Regex search across a specific repo
repo:my-org/my-repo func\w+Error

# Search for a pattern in a specific language
lang:go fmt.Errorf\(.*%w

# Search commit diffs for changes to a function
type:diff myCriticalFunction
See the Code Search queries reference for the full query syntax.
6

Invite your team

Navigate to Site Admin → Users and auth → Users → + Create user to add team members, or configure SSO to allow self-service sign-in.For SSO configuration, see the authentication docs.

What’s next for Cloud users

Cloud instance setup

Full guide to configuring your Cloud instance: SSO, email, and team management.

Take the tour

See Sourcegraph features demonstrated through real-world developer workflows.

Try Cody AI

Set up Cody in your editor and run your first AI-assisted interaction.

Try Deep Search

Ask natural language questions about your codebase and get sourced answers.

Self-hosted

Self-hosted deployment gives you full control over your Sourcegraph environment. You run Sourcegraph on your own infrastructure using Docker Compose (for smaller teams) or Kubernetes (for larger deployments).
Self-hosted deployment requires infrastructure setup and ongoing maintenance. If you want to get started quickly without managing infrastructure, use Sourcegraph Cloud.
The self-hosted deployment documentation covers:
  • System requirements and prerequisites
  • Docker Compose and Kubernetes deployment options
  • Configuring code hosts, authentication, and storage
  • Upgrading and scaling your instance

Self-hosted deployment guide

Complete instructions for deploying Sourcegraph on your own infrastructure.

Explore Sourcegraph features

Once you have a running instance with repositories connected, explore what Sourcegraph can do:

Code Search

Search across all your repos with regex, structural, and diff search.

Cody AI

AI assistant with full context over your codebase.

Code Navigation

IDE-like go-to-definition and find-references across all repos.

Batch Changes

Automate large-scale changes across many repositories.

Code Insights

Track codebase trends and migration progress over time.

Deep Search

Agentic AI search that answers complex questions about your code.