GH-REPO-AUTOLINK-CREATE(1)

okay so picture this: you're deep in the gh manual, section 1, and you've stumbled onto gh-repo-autolink-create. yes bestie, it's a real page in the GitHub CLI manual and it's about to make your repo way more connected. let's get into it ✨


✨ NAME ✨

gh-repo-autolink-create β€” literally just here to create a new autolink reference for you 🫢


🌸 SYNOPSIS 🌸

gh repo autolink create <keyPrefix> <urlTemplate> [flags]

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole bit: you're creating a new autolink reference for a repository. that's the vibe. πŸ’…

the keyPrefix argument is the prefix β€” the magic little string that, when certain characters get appended to it, generates a link. that's the whole trigger, iykyk.

the urlTemplate argument is the target URL that gets generated when the keyPrefix is found. important: it must contain the <num> variable for the reference number. no <num>, no link, periodt. 🚨

by default, autolinks are alphanumeric β€” and you use the --numeric flag to create a numeric autolink instead.

and here's the tea on how the <num> variable behaves, because it's genuinely different depending on which kind you picked:

  • alphanumeric: matches A-Z (case insensitive), 0-9, and -
  • numeric: matches 0-9
⚠️ real talk: if your template contains multiple instances of <num>, only the first one gets replaced. the rest just sit there. don't say i didn't warn you 😭

πŸ’– OPTIONS πŸ’–

  • -n, --numeric β€” marks the autolink as numeric. that's it, that's the flag. slay. πŸ”’

πŸ‘‘ OPTIONS INHERITED FROM PARENT COMMANDS πŸ‘‘

  • -R, --repo <[HOST/]OWNER/REPO> β€” selects another repository using the [HOST/]OWNER/REPO format. super handy when you're not already standing in the right repo 🫢

🌈 ALIASES 🌈

gh repo autolink new

yep β€” new works too, same energy, no cap ✨


⭐ EXIT CODES ⭐

  • 0: successful execution β€” we ate πŸ’…
  • 1: error β€” something went sideways 😭
  • 2: command canceled β€” you (or something) hit the brakes
  • 4: authentication required β€” go log in bestie πŸ”‘
πŸ“Œ NOTE: specific commands may have additional exit codes. refer to the command's help for more information.

πŸ“ EXAMPLE πŸ“

# Create an alphanumeric autolink to example.com for the key prefix "TICKET-".
# Generates https://example.com/TICKET?query=123abc from "TICKET-123abc".
$ gh repo autolink create TICKET- "https://example.com/TICKET?query=<num>"

# Create a numeric autolink to example.com for the key prefix "STORY-".
# Generates https://example.com/STORY?id=123 from "STORY-123".
$ gh repo autolink create STORY- "https://example.com/STORY?id=<num>" --numeric

look at that. two whole examples. the alphanumeric one is out here turning TICKET-123abc into a whole URL, and the numeric one is doing the STORY-123 thing with --numeric. iconic, honestly πŸ”₯


🧚 SEE ALSO 🧚

gh-repo-autolink(1) β€” go read the parent page too, bestie, it's the main character πŸ’œ


and that's the whole page!! πŸ¦‹ this little rewrite brought to you by GitHub CLI v2.102.0, dated Oct 2026 β€” mwah, go autolink something cute πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from