> ## Documentation Index
> Fetch the complete documentation index at: https://capy.sc/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# capy grant-branch: Scriptable Branch Access

> Grant a teammate access to a protected branch from CI: capy grant-branch <email> <project> <branch>. Non-interactive, exits non-zero on failure.

## Synopsis

```bash theme={null}
capy grant-branch <email> <project> <branch>
```

## Description

Grants `<email>` access to the named protected branch in the named project. Non-interactive - same operation as pressing `g` on a `(no access)` row in [`capy users`](/cli/users), but scriptable for CI.

The user must already be a member of the org. Granting access to a non-protected branch is a no-op; non-protected branches are visible to every member by default.

## Example

```bash theme={null}
$ capy grant-branch alice@acme.com web-frontend production
Granted alice@acme.com access to web-frontend/production
```

## Failure modes

| Exit reason                            | Cause                                                   |
| -------------------------------------- | ------------------------------------------------------- |
| `Project "<name>" not found`           | The project name doesn't match any project in this org  |
| `Branch "<name>" not found in project` | The branch doesn't exist in that project                |
| `No member with email "<email>"`       | The user isn't a member of this org - invite them first |
| `Authentication failed`                | Your local session expired; run `capy` to re-auth       |

All exits are non-zero on failure, suitable for CI.

## See also

* [`capy revoke-branch`](/cli/revoke-branch) - the inverse
* [`capy users`](/cli/users) - interactive equivalent
* [Protected branches](/using/branches/protected) - the concept
