GH-REPO-DEPLOY-KEY-ADD(1)
π gh-repo-deploy-key-add(1) β the GitHub CLI manual, bestie edition π
okay so real quick before anything else β this is a page from the GitHub CLI manual, and it's about gh-repo-deploy-key-add. yes that's a mouthful, no i will not be shortening it, it's iconic and it knows it β¨
πΈ NAME πΈ
gh-repo-deploy-key-add β literally just adds a deploy key to a GitHub repository π«Ά
π¦ SYNOPSIS π¦
gh repo deploy-key add <key-file> [flags]
that's it. that's the whole vibe. one key file, some optional flags, slay π
β¨ DESCRIPTION β¨
so what does it do? bestie. it adds a deploy key to a GitHub repository. that's the entire assignment and it ate π₯
β οΈ okay now the important bit, pay attention, this is giving very much "read the fine print" energy: any key added by gh will be associated with the current authentication token. and here's the part that lowkey hurts π β if you de-authorize the GitHub CLI app or the authentication token from your account, then any deploy keys added by GitHub CLI will be removed as well. gone. poof. no cap. so like, know that going in π
π OPTIONS π
-w,--allow-writeβ lets the key have write access. yes ma'am, write privileges, use responsibly π-t,--title <string>β the title of the new key. give it a cute name, it deserves one π
π OPTIONS INHERITED FROM PARENT COMMANDS π
these bad boys come from the parent command, so they're not even this command's fault, they're just along for the ride π
-R,--repo <[HOST/]OWNER/REPO>β pick a different repository using the[HOST/]OWNER/REPOformat. note the square brackets, they're doing real work there β¨
β EXIT CODES β
vibe check results, iykyk:
0β Successful execution π (we love a win)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 β the manpage said so, so i'm saying so π
π§ EXAMPLE π§
here's the group-chat demo, look how easy:
# 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
step one: generate a passwordless SSH key with ssh-keygen -t ed25519 -C "my description" -N "" -f ~/.ssh/gh-test ποΈ step two: gh repo deploy-key add ~/.ssh/gh-test.pub and boom, deploy key added, main character energy achieved π
π SEE ALSO π
gh-repo-deploy-key(1)β the whole deploy-key situation, go read it, it's giving lore π
okay that's the whole page!! go forth and deploy responsibly, bestie π
anyway this was the GitHub CLI manual, and the page itself is GitHub CLI v2.102.0, dated Oct 2026 β signed, sealed, delivered, periodt π β¨
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms