How-To: Configure Git Tenant¶
Goal: Add documentation from a GitHub or GitLab repository to your deployment.
Prerequisites: Repository with markdown files, deployment.json configured, Docker container running.
Time: ~10 minutes
When to Use Git Tenants¶
Choose git tenants when:
✅ Documentation lives in a GitHub/GitLab repository
✅ Source is markdown files (not generated HTML)
✅ You want deterministic syncs (exact repo contents)
✅ Offline capability matters (works after initial clone)
Benefits over online crawling: - Lighter on resources (no HTML parsing) - Git-tracked updates (commit-level freshness) - Faster sync (pull vs. full crawl)
Avoid git tenants when: - Docs require rendering (complex HTML, interactive elements) - Repository is private without access token - Source files aren't markdown (e.g., RST, AsciiDoc)
Steps¶
1. Identify Repository Details¶
Gather this information:
- Repository URL: HTTPS URL (e.g., https://github.com/mkdocs/mkdocs.git)
- Branch: Usually main or master
- Documentation path: Folder containing markdown files (e.g., docs/)
2. Add Tenant to deployment.json¶
Edit deployment.json and add a new tenant to the tenants array:
{
"source_type": "git",
"codename": "mkdocs",
"docs_name": "MkDocs Documentation",
"git_repo_url": "https://github.com/mkdocs/mkdocs.git",
"git_branch": "master",
"git_subpaths": ["docs"],
"git_strip_prefix": "docs",
"docs_root_dir": "./mcp-data/mkdocs",
"refresh_schedule": "0 */6 * * *",
"test_queries": {
"natural": ["How to create a new MkDocs project"],
"phrases": ["configuration", "navigation"],
"words": ["mkdocs", "theme", "plugins"]
}
}
Required Fields
source_type: Must be"git"codename: Unique lowercase identifierdocs_name: Human-readable namegit_repo_url: HTTPS repository URLgit_subpaths: Array of paths to include (at least one)docs_root_dir: Local storage path
Optional Fields
git_branch: Branch name (default:"main")git_strip_prefix: Remove leading path when copying filesrefresh_schedule: Cron schedule for auto-sync
3. Redeploy the Container¶
4. Trigger Initial Sync¶
Wait for sync to complete (usually 30-60 seconds for git tenants).
5. Verify Sync Status¶
Check container logs for sync completion:
You should see a message like "Git sync completed" with a file count and commit hash.
6. Test Search¶
Private Repositories¶
For private repositories, use a personal access token:
1. Create Token¶
- GitHub: Settings → Developer settings → Personal access tokens → Generate new token (repo scope)
- GitLab: User Settings → Access Tokens → Create token (read_repository scope)
2. Set Environment Variable¶
3. Reference in deployment.json¶
{
"source_type": "git",
"codename": "private-docs",
"git_repo_url": "https://github.com/org/private-repo.git",
"git_auth_token_env": "GH_TOKEN",
"git_subpaths": ["docs"],
"docs_root_dir": "./mcp-data/private-docs"
}
4. Pass to Docker¶
Multiple Documentation Paths¶
To include multiple folders from one repository:
Directory Structure Preserved
This syncs docs/, tutorials/, and reference/ folders, keeping their directory structure.
Troubleshooting¶
Sync fails with "Repository not found"¶
Cause: Invalid URL or private repo without token.
Fix:
1. Verify URL: git ls-remote https://github.com/org/repo.git
2. For private repos, set git_auth_token_env and pass the token
No documents after sync¶
Cause: Wrong git_subpaths or no markdown files.
Fix:
1. Check repository structure: git clone --depth 1 <url> && tree <path>
2. Verify git_subpaths points to folders with .md files
Sync completes but search returns no results¶
Cause: Index not rebuilt after sync.
Fix:
Related¶
- Tutorial: Adding Your First Tenant — Step-by-step tenant setup
- How-To: Configure Online Tenant — For website documentation
- Reference: deployment.json Schema — All configuration options
- Explanation: Sync Strategies — Git vs online sync