Sourcegraph DocsSourcegraph Docs
  • Code Intelligence

    • Cody
    • Code Search
  • Code Management

    • Batch Changes
    • Code Monitoring
    • Code Ownership
    • Code Insights
    • Notebooks
  • Platform

    • Sourcegraph Admin
    • Sourcegraph Cloud
    • Integrations
  • CLI & API

    • Sourcegraph & Cody CLI
    • Sourcegraph GraphQL API
    • Sourcegraph Stream API
  • Help & Support

    • SLAs & Premium Support
    • How to videos
    • Tutorials
    • Sourcegraph Accounts
    • Changelog
    • Technical changelog
    • Releases
  1. Docs
  2. admin
  3. repo
  4. add

Add repositories (from code hosts) to Sourcegraph

  • Add repositories from a code host (GitHub (Cloud or Self-hosted), GitLab (Cloud or Self-hosted), Bitbucket Server, Bitbucket Data Center, or Perforce)

    • GitHub
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Server / Bitbucket Data Center or Bitbucket Data Center
  • Add repositories by Git clone URLs

  • Add repositories from non-Git code hosts

    • Add Perforce repositories
    • Add JVM dependencies
    • Add Go dependencies
    • Add npm dependencies
    • Add Python dependencies
  • Pre-load repositories from the local disk

Troubleshooting

Repositories not showing up

If your repositories are not showing up, check the site admin Repositories page on Sourcegraph (and ensure you're logged in as an admin). If nothing informative is visible there, check for error messages related to communication with your code host's API in the logs from:

  • Docker Compose and Kubernetes: the logs from the repo-updater container/pod
  • Single-container: the sourcegraph/server Docker container

Repository not cloning or updating

If your repositories are showing up but are not cloning or updating from the original Git repository:

  • Follow the instructions for troubleshooting a repository that is not being updated

Sourcegraph can't connect to your code host

If Sourcegraph displays errors when syncing repositories from your code host, please click the "Test connection" button on the code host configuration page.

If the connection test fails with errors like:

Connection check failed: request failed: context deadline exceeded

This error might indicate that the code host is not reachable from your Sourcegraph instance.

or:

Connection check failed: request failed: Get "https://nonexistenturl.com/api/v3/user": dial tcp: lookup nonexistenturl.com: no such host

This error might indicate that the code host is not reachable from your Sourcegraph instance.

These errors suggest that your code host is not reachable over the network from your Sourcegraph instance, which is required for Sourcegraph to sync repositories from your code host. In order to resolve this network issue, some fixes might include any / all of:

  • Making your code host accessible over the public internet
  • Configuring your Sourcegraph instance's network to allow outbound connections to your code host
  • Tweaking the firewall configuration to allow inbound connections to your code host from your Sourcegraph instance
  • Tweaking the DNS configuration of your Sourcegraph instance to resolve your code host's domain name to the IP address of your code host
  • etc.

The specific configuration steps depend on your network setup. If you need assistance, please contact your network administrator or customer support.

On this page

  1. Add repositories (from code hosts) to Sourcegraph

    1. Troubleshooting

Edit this page on GitHub
Questions? Give us feedback