How to Create and Use an AI Git Agent
An LLM-driven Git agent runs Git commands inside an alpine/git container while authenticating with the user's own SSH keys, so non-Git users such as UI tech writers can fetch, check out PR branches and get a three-dot diff of changed files. A setup prompt mounts ~/.ssh read-only and ~/.gitconfig into a container, then copies them to a writable location. It fixes container-breaking settings such as UseKeychain and carriage-return rules, and persists the result to a /thread volume that the Git tool copies in before each command. Tagging the thread in the VSCode extension keeps credentials across runs, and read-only credentials could let people without a local Git install review PRs.
Related posts
- Breaking Free From AI Vendor Lock-in: Integrating GitHub Models with Docker cagent
Docker mediumAdeptDocker cagent, an open-source multi-agent runtime driven by declarative YAML, can use GitHub Models as a custom OpenAI-compatible provider. You point base_url at https://models.github.ai/inference and pass a GitHub personal access token as the API key, so one credential reaches models from OpenAI, Meta, Microsoft, Anthropic and DeepSeek. The walkthrough builds a podcast-generator agent whose root agent delegates to researcher and scriptwriter sub-agents that use DuckDuckGo and filesystem MCP servers through the Docker MCP gateway. The agent is then shared through Docker Hub with cagent push, pull and run.
- How AI Assistants Can Decode GitHub Repos for UI Writers
Docker mediumAdeptAn LLM agent can reliably flag user-facing copy changes in a branch when it is given narrow tools and expert hints about what "user-facing" means. GitHub Copilot's repo chat could not even count open PRs. A first prompt that gave the model bash and raw git diff also failed: diffs were huge, important files were buried and extra tools invited hallucination. The working two-step flow first lists only likely UI files (using --files-only and --no-pager with an alpine/git container) and saves the list. It then diffs just those files against main with --no-color --minimal, guided by frontend-engineer hints about JSX text nodes, notifications, toasts and Error constructors. This produced an accurate list of copy changes on a real Docker PR.
- How an AI Assistant Can Help Configure Your Project’s Git Hooks
Docker mediumAdeptAn LLM assistant's advice on configuring Git hooks goes from generic to project-specific when the prompt is enriched with context from containerized analysis tools (a linguist image detecting repository languages, bound in via mustache templates) and with expert knowledge such as an organization's preferred pre-commit base config and per-language hooks like golangci-lint. With these additions the model produces ready-to-use pre-commit-config.yaml files and hook scripts, and even extends the established syntax to tools it wasn't told about. Registering a file-writer tool turns the response into OpenAI function calls that an agent executes to write the config directly. Delivering every tool as a lazily pulled Docker container smooths over the environment problems that otherwise block local assistants.
- Building AI Agents with Docker MCP Toolkit: A Developer’s Real-World Setup
Docker mediumAdeptA GitHub repository question-answering agent is built by running the GitHub MCP Gateway (docker/mcp-gateway) as a container under Docker Compose and connecting a Python agent to it over streamable-http via MCPTools. The gateway lists files, fetches content and searches code, and GPT-4o reasons over the results. Setup takes a few commands: store a GitHub token with `docker mcp secret set`, run `docker compose up`, then run app.py. The main argument is that containerized MCP connectors keep integration code out of the agent and give consistent environments, and new tools such as Jira or Slack can be added as extra Compose services.
- Running AI agents in GitHub Actions with Docker Sandboxes
Docker mediumAdeptGitHub Agentic Workflows (gh-aw 0.82.9) supports Docker Sandboxes (sbx) as an agent runtime, so a CI coding agent gets root, sudo and unrestricted shell inside a disposable microVM with its own kernel and private Docker daemon. Outside that VM it is limited by a network allowlist, a read-only token and a safe-output job that may only touch src/**. In the worked example, a Copilot agent on an ubuntu-24.04 runner runs a Java 21 Testcontainers/PostgreSQL suite, adds a regression test exposing a case-sensitive email uniqueness bug, applies a one-line normalization fix, and opens a draft PR. The run took about 11 minutes, and setup needs Docker credentials as secrets plus a KVM-capable host for self-hosted runners.