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:
repos/
├─ repo_1/
├─ repo_2/
├─ repo_3/
├─ ...
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:
docker run \
    -v $(pwd)/repos:/repos:ro \
    /* additional args */ \
    ghcr.io/sourcebot-dev/sourcebot:latest
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:
{
    "type": "git",
    "url": "file:///repos/*"
}
Sourcebot will expand this glob pattern into paths /repos/repo_1, /repos/repo_2, etc. and index all valid git repositories.

Examples

Schema reference