Skip to main content
Sourcebot can sync code from generic git repositories stored in a local directory. This can be helpful in scenarios where you already have a large number of repos already checked out. Local repositories are treated as read-only, meaning Sourcebot will not git fetch new revisions. If you’re not familiar with Sourcebot connections, please read that overview first.

Getting Started

Only folders containing git repositories at their root and have a remote.origin.url set in their git config are supported at this time. All other folders will be skipped.
Let’s assume we have a repos directory located at $(PWD) with a collection of git repositories:
To get Sourcebot to index these repositories:
1

Mount a volume

We need to mount a docker volume to the repos directory so Sourcebot can read it’s contents. Sourcebot will not write to local repositories, so we can mount a separate read-only volume:
2

Create a connection

We can now create a new git connection, specifying local paths with the file:// prefix. Glob patterns are supported. For example:
Sourcebot will expand this glob pattern into paths /repos/repo_1, /repos/repo_2, etc. and index all valid git repositories.

Examples

Optimizing git operations

Sourcebot performs a number of operations that require traversing a repository’s entire commit history (e.g., git rev-list --count HEAD). These operations can be slow in repositories with a large number of commits. Typically, a commit graph is generated to speed up these operations (see #791). However, since local repositories are treated as read-only, Sourcebot will not generate a commit graph for them. A commit graph can be manually generated by running the following command in the repository’s root directory:
The commit graph can be updated when fetching with --write-commit-graph:

Schema reference

schemas/v3/genericGitHost.json