GH-REPO-DEPLOY-KEY-ADD(1) GitHub CLI manual GH-REPO-DEPLOY-KEY-ADD(1)

# [NAME](#NAME)

gh-repo-deploy-key-add - Add a deploy key to a GitHub repository

# [SYNOPSIS](#SYNOPSIS)

**gh repo deploy-key add &lt;key-file&gt; \[flags]**

# [DESCRIPTION](#DESCRIPTION)

Add a deploy key to a GitHub repository.

Note that any key added by gh will be associated with the current authentication token. If you de-authorize the GitHub CLI app or authentication token from your account, any deploy keys added by GitHub CLI will be removed as well.

# [OPTIONS](#OPTIONS)

[**-w**, **--allow-write**](#w)

Allow write access for the key

[**-t**, **--title** **&lt;string&gt;**](#t)

Title of the new key

# [OPTIONS INHERITED FROM PARENT COMMANDS](#OPTIONS_INHERITED_FROM_PARENT_COMMANDS)

[**-R**, **--repo** **&lt;\[HOST/\]OWNER/REPO&gt;**](#R)

Select another repository using the \[HOST/]OWNER/REPO format

# [EXIT CODES](#EXIT_CODES)

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

# [EXAMPLE](#EXAMPLE)

```
# Generate a passwordless SSH key and add it as a deploy key to a repository
$ ssh-keygen -t ed25519 -C "my description" -N "" -f ~/.ssh/gh-test
$ gh repo deploy-key add ~/.ssh/gh-test.pub
```

# [SEE ALSO](#SEE_ALSO)

[**gh-repo-deploy-key(1)**](/man/os/gh/gh-repo-deploy-key.1)

Oct 2026

---

Document: gh-repo-deploy-key-add(1) from gh 2.102.0-r1 (Chainguard OS)
Source: https://github.com/cli/cli
