/site-admin/configuration). Changes take effect immediately unless noted otherwise.
Some settings require a frontend service restart to take effect:
auth.providers, externalURL, insights.query.worker.concurrency, and permissions.syncUsersMaxConcurrency.Essential settings
Every Sourcegraph instance should configure at minimum:externalURL: The publicly accessible URL for your instance. Required for auth callbacks, email links, and webhooks to work correctly. Use the exact scheme (https://), no trailing slash.auth.providers: Configures sign-in. See Authentication for all options.licenseKey: Activates Enterprise features. Contact [email protected] for a key.
Code host connections
Code host connections are configured at Site admin > Manage code hosts, not directly in site config JSON. Each connection type uses a JSON configuration object specific to that host.GitHub
url: Usehttps://github.comfor GitHub.com, or your GitHub Enterprise URL.token: A personal access token or GitHub App withrepoandread:orgscopes.orgs/repos: Control which repositories are synced.authorization: Enable permission syncing so users only see repositories they have access to on GitHub.
GitLab
read_api scope. Add api scope if you are using Batch Changes.
Bitbucket Cloud
Repositories: Read and Account: Read permissions.
Bitbucket Server / Data Center
Gerrit
Repository permissions
Sourcegraph can enforce the same repository access controls your code host uses. When permissions are enabled, users only see repositories they can access on the code host. Enable permissions syncing by addingauthorization to your code host configuration (shown in the examples above). Then tune the sync schedule:
bindID to "email" (default) or "username" to control how Sourcegraph matches API-supplied permissions to user accounts.
Search settings
search.limits.maxRepos: Maximum number of repositories searched in a single query.-1means unlimited.search.limits.maxTimeoutSeconds: Maximum search timeout. Increase for large instances where searches regularly time out.search.largeFiles: Glob patterns for files that should be indexed regardless of size (must be valid UTF-8).search.index.symbols.enabled: Enable symbol search in the index. Requires all repositories to re-index (time-consuming) and additional storage.
Email / SMTP
Configure SMTP to send password reset emails, access request notifications, and Code Monitor alerts.authentication accepts "PLAIN", "CRAM-MD5", or "none".
You can customize the subjects and bodies of password reset and account setup emails:
Licensing
Batch Changes
batchChanges.restrictToAdmins: Limit batch change creation to site admins.batchChanges.enforceForks: Push all batch changes branches to forks of the target repository.batchChanges.rolloutWindows: Throttle changeset publishing to specific days and times (UTC).
Branding
You can customize the Sourcegraph logo and browser favicon shown to users:Security and session settings
auth.sessionExpiry: Sessions expire after this duration (default: 90 days). Requires restart.auth.minPasswordLength: Minimum password length for builtin auth (default: 12).auth.accessTokens.allow:"all-users-create"(default),"site-admin-create", or"none".auth.allowedIpAddress: Restrict instance access to specific IP ranges.
Editing site config without the web UI
If you cannot access the web UI, you can edit the site config directly in the container.- Docker Compose
- Kubernetes
Where is the full site config reference?
Where is the full site config reference?
The full reference with all fields and defaults is maintained in the Sourcegraph source. You can view it at Site admin > Configuration — the editor shows inline documentation for each field as you type.
Why isn't my config change taking effect?
Why isn't my config change taking effect?
Some settings require a frontend service restart:
auth.providers, externalURL, insights.query.worker.concurrency, and permissions.syncUsersMaxConcurrency. Check the frontend container logs for errors if a change does not appear to apply.How do I reset site config to defaults?
How do I reset site config to defaults?
Replace the contents with the minimal default config: