Git
The Git connector lets an agent work on GitHub repositories as a real person. Each user connects their own GitHub account once. After that, an agent working for them can read files, commit, push and open pull requests, and GitHub shows all of it under that user's name, with that user's access.
The agent never sees a GitHub token. Willow keeps the user's token and attaches it to each request itself.
This is different from two neighbours:
- The GitHub connector covers issues, reviews and the rest of the GitHub API. Git covers code: branches, commits, clones and pushes.
- Git Proxy gives background agents git through a GitHub App, so pushes come from the App. The Git connector pushes as the user.
How it works
There are two ways to change code.
Small changes, without a clone. The agent reads files with Read File, then writes all its changes in one commit with Commit Files. GitHub makes the commit directly, under the user's account.
Bigger changes, with a working copy. The agent calls Get Git Remote for one repository. Willow returns a link like this:
https://willow:wgr_...@acme.withwillow.ai/mcp/git-remote/acme/github.com/acme/payments.git
The agent uses it with plain git:
git clone https://willow:wgr_...@acme.withwillow.ai/mcp/git-remote/acme/github.com/acme/payments.git
cd payments
git checkout -b fix-rounding
# edit, build, test
git commit -am "Fix rounding"
git push origin fix-rounding
The wgr_... part is not a GitHub token. It is a Willow key that works only for that one repository and only for one hour. On every clone, fetch or push, Willow checks the key, attaches the user's GitHub token and passes the request on to GitHub.
Either way, the agent finishes with Create Pull Request, and the pull request is opened by the user.
Set it up
1. Create a GitHub OAuth App
Follow Create a GitHub OAuth App on the GitHub page. The callback URL is the same. A GitHub App's OAuth credentials work too, and are the safer choice: a user's token then only reaches repositories the App is installed on.
2. Add the MCP server
- In Willow, go to MCP Servers → + Add MCP Server.
- Find Git and click Use.
- Select the risk level of the tools to share and click Create.
- Under Setup tab, Authentication, select OAuth and paste the Client ID and Client Secret.
- Pick the scopes:
- Public repositories: public repositories only.
- Repositories: public and private repositories. Pushes that change GitHub Actions workflow files are refused by GitHub.
- Repositories and workflows: the same, including workflow files.
- Click Save Changes.
Instead of OAuth, you can let each user paste their own personal access token when they connect.
3. Each user connects
Users open Git in the portal, click Connect and approve on GitHub. Until they do, Git tools called for them answer that the user has not connected Git.
Use it from an agent
From Cursor, Claude Code or another MCP client, nothing extra is needed. If the client already connects to Willow, the Git tools appear, and they run as the signed-in user.
From a background agent, add Git to the agent's tools, then choose whose account it uses:
- Act as whoever triggers the run: each run uses the GitHub account of the person who started it. If they have not connected Git yet, they are asked to.
- Act as me: every run uses your GitHub account.
- The agent's own account: every run uses a GitHub account the agent signed in with, such as a bot user.
Get Git Remote refuses custom credentials set on the agent, because a remote stands for a person's own connection. The other tools work with them.
To use Get Git Remote, the agent's sandbox needs git and network access to your Willow host.
A short instruction is enough for the agent:
For a change to a few files, use Read File, Create Branch, Commit Files and Create Pull Request. For work you need to build or test, call Get Git Remote with access "write", clone the URL it returns, push to a new branch and open a pull request. If git fails with
remote_expired, call Get Git Remote again and rungit remote set-url origin <new url>. Never print the remote URL.
Tools
| Tool | What it does |
|---|---|
| List Repositories | Repositories the user can see, with whether they can push. |
| Get Repository | One repository's details and the user's permissions on it. |
| List Branches, Get Branch | Branches and their head commit. |
| Create Branch | Starts a branch at a commit. |
| Delete Branch | Off by default. |
| Get Tree | Every file path in a branch, optionally under one directory. |
| Read File | A file's content at a branch, tag or commit. |
| Commit Files | Adds, changes and deletes several files in one commit. |
| List Commits, Compare | History, and the difference between two refs. |
| Create Pull Request, Get Pull Request | Opens and reads pull requests. |
| Merge Pull Request | Off by default. |
| Get Git Remote | A one-hour git link for one repository. |
Commit Files needs the branch's current head commit, from Get Branch. If someone pushed to the branch in the meantime, the commit fails instead of overwriting their work; the agent reads the branch again and retries.
Get Git Remote
The agent asks for access: "read" (the default) or access: "write". Willow asks GitHub what the user can do in the repository and grants push only when the agent asked for write and the user can push. Otherwise the remote is fetch only.
Every request through the remote is checked again:
- The user must still be connected and active in Willow. Disconnecting Git or deactivating the user stops the remote at once, before the hour is up.
- The request must be for the repository the remote was made for.
- A push needs a remote made with write access.
Commits pushed with git carry the name and email in the agent's local git config. The push itself is made as the user. Commits made with Commit Files are authored by the user's GitHub account.
Troubleshooting
Git prints the error Willow returns as willow-git: <code>.
| Error | Cause | Fix |
|---|---|---|
remote_expired | The remote is older than an hour, or was never valid. | Call Get Git Remote again and run git remote set-url origin <new url>. |
repo_not_allowed | The remote was used for a different repository. | Get a remote for that repository. |
repo_is_read_only | A push through a fetch-only remote. | Ask for access: "write". If the user cannot push to the repository on GitHub, the remote stays fetch only. |
not_connected | The user has not connected Git, or disconnected it. | The user connects Git in the portal. |
user_deactivated | The user was deactivated in Willow. | Use another user's account. |
remote_revoked | The Git MCP server was removed or replaced. | Get a new remote. |
| Git asks for a username | The URL lost its willow:wgr_...@ part, for example when copied by hand. | Use the full URL from Get Git Remote. |
Security
- The user's GitHub token stays in Willow. The agent gets a Willow key that works for one repository for one hour, through Willow only.
- Willow stores a hash of the key, never the key itself, and never writes it to the audit log.
- Anyone holding the URL can use it until it expires, so agents should not print it. It is stored in the clone's
.git/config. - Each tool call, including Get Git Remote, is in the audit log under the user and the agent.