Skip to main content

Git Repositories

FleetQ can connect to Git repositories and expose them to agents via MCP tools. Agents can inspect working trees, read commit history, make changes, create branches, and push — enabling coding workflows entirely within the agent pipeline.

Scenario: A "Dependency Updater" agent clones your repo, runs npm outdated, creates a branch, bumps package versions, commits the changes, and opens a pull request — no human involved until review.

Connecting a repository

Repositories are registered as Git Repository records scoped to your team. You can connect them via the UI or the API. Supported providers: GitHub, GitLab, Bitbucket, and any server accessible over SSH or HTTPS.

Via the UI

  1. Navigate to Git Repositories → Connect Repository.
  2. Enter the remote URL (HTTPS or SSH).
  3. Select or create a Credential for authentication (personal access token, SSH key, or OAuth2 token).
  4. Save. FleetQ clones the repo and verifies connectivity.

Via the API

bash
curl -X POST https://fleetq.169.58.89.204.sslip.io/api/v1/git-repositories \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-service",
    "remote_url": "https://github.com/acme/my-service.git",
    "credential_id": "cred_uuid",
    "default_branch": "main"
  }'
Store your personal access token or deploy key as a Credential first (type api_key or bearer_token), then reference its ID when connecting the repository. This keeps secrets out of repository records.

Git operations

Once a repository is connected, agents can perform git operations through the MCP tools listed below. All operations are scoped to the repository's working directory on the FleetQ host.

MCP tool Description
git_status Show the working tree status — staged, unstaged, and untracked files.
git_log Retrieve commit history with optional branch, author, or path filters.
git_diff View changes between the working tree, index, or any two refs.
git_branches List local and remote branches, create a new branch, or switch the current branch.
git_commit Stage files and create a commit with a message. Supports --all and path-specific staging.
git_push Push the current branch (or a named branch) to the configured remote.
git_pull Pull the latest commits from the remote into the current branch.
git_stash Stash uncommitted changes or pop the latest stash entry.
git_blame Show per-line commit and author information for a file.
git_checkout Restore files from a ref, or check out a specific commit or branch.
git_merge Merge a branch into the current branch. Returns conflict information if the merge cannot complete cleanly.
git_tag List, create, or delete lightweight and annotated tags.
git_remote List configured remotes or add/remove a remote URL.

Use cases

Code review automation

An agent fetches a pull request diff via git_diff, reviews it against your style guide, and posts inline comments or summaries as experiment artifacts.

Automated refactoring

An agent creates a branch, modifies files using the Filesystem tool, commits with git_commit, and pushes — ready for human review.

Documentation generation

An agent reads source files, generates documentation, writes it back to the repo, and opens a PR — keeping docs in sync automatically on every release.

Dependency updates

Combine the Bash tool with git tools: run npm outdated, apply safe updates, run tests, then commit and push only if tests pass.

Test generation

An agent reads changed files via git_diff, generates missing test coverage with an LLM skill, and commits the new test files to a dedicated branch.

Release tagging

A project run triggers an agent that bumps the version, commits the changelog, and creates an annotated tag via git_tag on every successful build.

Security

Repository access is team-scoped — agents can only operate on repositories belonging to your team. Credentials are encrypted at rest using per-team envelope encryption and are never exposed in plaintext through the API or MCP tools.

  • Explicit grant: agents only access repositories they're explicitly assigned to. No agent can read or write repositories from other teams or unassigned repos within your team.
  • Credential isolation: push/pull credentials are resolved at runtime from the encrypted Credential record — never stored in the repo config.
  • Audit trail: all git operations are recorded in the audit log with the agent, experiment, and timestamp, giving full traceability for compliance workflows.
Give agents write access only when required. For read-only workflows (code review, documentation), use a deploy key or token with read-only scope on the provider side.

API endpoints

Method Path Purpose
GET /api/v1/git-repositories List all connected repositories.
POST /api/v1/git-repositories Connect a new repository.
GET /api/v1/git-repositories/{id} Retrieve a repository by ID.
PUT /api/v1/git-repositories/{id} Update repository settings (URL, credential, default branch).
DELETE /api/v1/git-repositories/{id} Disconnect a repository. Local clone is removed.