Skip to content

[bug] Git config --local fails on bare repositories causing complete repository indexing failure in v4.7.0 #523

@shaharkedar

Description

@shaharkedar

Describe the bug

Sourcebot v4.7.0 seems to have a critical bug that prevents all repository indexing from working. The issue occurs in the repository cloning and configuration process where:

  1. Repositories are correctly cloned as bare repositories using git clone --bare
  2. Later in the process, the code attempts to read git configuration using GitConfigScope.local (which translates to git config --local)
  3. The --local flag is incompatible with bare repositories and fails with: fatal: --local can only be used inside a git repository
  4. This causes all repository indexing jobs to fail after 3 retry attempts
  5. No repositories can be indexed, making search functionality completely non-functional

Expected Behavior
Repositories should be successfully cloned and indexed, with logs showing:
• Cloned [repository] in X.XXs
• Indexing [repository]...
• Indexed [repository] in X.XXs
• Repo index job for repo [repository] completed

Actual Behavior
Repository indexing fails with the following error pattern:

[backend] | 2025-09-19T10:32:56.025Z error: [repo-manager] Failed to sync repository github.com/sourcebot-dev/sourcebot (id: 1), attempt 1/3. Sleeping for 60s... Error: Error: Failed to set git config /data/.sourcebot/repos/1: fatal: --local can only be used inside a git repository

To reproduce

  1. Create a basic config.json file:
{ "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", "connections": { "test-connection": { "type": "github", "repos": [ "sourcebot-dev/sourcebot" ] } } } 
  1. Create a docker-compose.yml with Sourcebot v4.7.0:
services: postgres: image: postgres:16 environment: POSTGRES_DB: sourcebot POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_HOST_AUTH_METHOD: trust volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 5 sourcebot: image: ghcr.io/sourcebot-dev/sourcebot:latest # v4.7.0 depends_on: postgres: condition: service_healthy redis: condition: service_healthy ports: - "3000:3000" volumes: - .:/data environment: - CONFIG_PATH=/data/config.json - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/sourcebot - REDIS_URL=redis://redis:6379 - DATA_CACHE_DIR=/data/.sourcebot - DATABASE_EMBEDDED=false - SOURCEBOT_LOG_LEVEL=debug volumes: postgres_data: redis_data: 
  1. Start the services and monitor the logs.

Sourcebot deployment information

Environment
• Host OS: macOS (also affects Linux deployments)
• Docker: Docker Compose v2+
• Deployment Method: Docker containers with separate PostgreSQL and Redis services

Affected Versions
• Sourcebot: v4.7.0 (latest as of 2025-09-19)
• Status: Critical regression bug

Working Versions
• Sourcebot: v4.6.0 and earlier versions work correctly

Additional information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions