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/REPO format. 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 πŸ“


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