Back to Resources

How to use GitHub autolinked references

Post GitHub URL, issue, SHA, @mention, and custom autolink tokens via gh --body-file, then prove stored source with gh issue view --json.

What this covers

In issues, pull requests, discussions, and similar conversation surfaces, GitHub turns many raw references into short links for you. You type the reference; GitHub renders the link. This how-to mirrors the tables and notes on Autolinked references and URLs.

Flowchart
4 linescompact
flowchart LR
    Input["Raw Reference: URL, #123, SHA, @user"] --> Engine["GitHub Autolink Engine"]
    Engine --> Link["Clickable Hyperlink"]
    Engine --> Card["Hover Card Preview"]
Rendered from Mermaid source with the native ZeroLabs diagram container.

URLs

Paste a normal URL. GitHub turns it into a link.

Visit https://github.com

For manual link Markdown, see Basic writing and formatting syntax.

Issues and pull requests

Inside conversations, these forms become short links:

Reference typeRaw referenceShort link
Issue or pull request URLhttps://github.com/jlord/sheetsee.js/issues/26#26
# and number#26#26
GH- and numberGH-26GH-26
Username/Repository# and numberjlord/sheetsee.js#26jlord/sheetsee.js#26
Organization_name/Repository# and numbergithub-linguist/linguist#4039github-linguist/linguist#4039

If you put an issue, pull request, or discussion reference in a list, GitHub can unfurl title and state. See About tasklists.

Labels

Paste a label’s URL from the same repository and GitHub renders the label chip. Cross-repo label URLs stay ordinary links.

Find a label URL on the repository Labels page by opening a label. Example:

markdown
https://github.com/github/docs/labels/enhancement

Commit SHAs

Reference typeRaw referenceShort link
Commit URLfull …/commit/ URLshort SHA
SHAfull 40-character SHAshort SHA
User@SHAjlord@a5c3785…jlord@a5c3785
Username/Repository@SHAjlord/sheetsee.js@a5c3785…jlord/sheetsee.js@a5c3785

Private-repo SHA caveat

When a commit message references a commit in a private repository, GitHub only shortlinks the SHA if at least one author or committer of the referencing commit has at least read access to the referenced commit.

If admins configured custom autolinks (for example Jira or Zendesk), matching references shorten the same way. Ask a repository admin which patterns exist. See Configuring autolinks to reference external resources.

A normal GitHub URL reference creates a backlink (for example, linking an issue from a PR also links the PR from the issue). To avoid that, build the URL with redirect.github.com instead of github.com. Hover cards are also skipped for those URLs.

Further reading

Share