Skip to content

Self-hosted git URL support (S0) #387

Closed

Description

@vybe

Summary

Add environment variable overrides for git base URL to support GHES, Gitea, and local reproduction of git sync issues.

Context

Currently Trinity hardcodes `https://github.com\` and `https://api.github.com\`. This blocks:

  1. Self-hosted Git (GHES, Gitea, GitLab)
  2. Local reproduction of git sync bugs (essential for testing S1-S7)

Acceptance Criteria

New environment variables

Backend changes

  • `src/backend/services/github_service.py` — use `TRINITY_GIT_API_BASE`
  • `src/backend/services/git_service.py` — new `_git_remote_url()` helper using `TRINITY_GIT_BASE_URL`
  • `src/backend/services/agent_service/crud.py` — propagate env var to agent container

Agent container changes

  • `docker/base-image/startup.sh` — compose `CLONE_URL` from env var

Backward compatibility

  • When env vars unset, behavior unchanged (defaults to github.com)
  • Test that defaults still work

Technical Notes

~30 lines of code, zero schema change. Gitea's API returns the same shape as GitHub's for repo operations, so the single base-URL swap works end-to-end.

This enables local reproduction of all other git sync issues via `docker-compose.gitea.yml` overlay.

Part of Epic #381

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p2theme-reliabilitytype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions