gh gist create Share a file or snippet as a GitHub gist
Uploads one or more files as a gist, a small shareable snippet with its own URL. Gists are secret (unlisted) by default.
Synopsis
gh gist create [FILE... | -] [FLAGS]
Common options
| Option or form | What it does |
|---|---|
-p, --public | Make it public and searchable |
-d, --desc TEXT | Add a description |
-f, --filename NAME | Name for text read from standard input |
-w, --web | Open the gist in the browser |
- | Read the content from standard input |
Examples
gh gist create notes.txt
https://gist.github.com/octocat/abc123
gh gist create a.js b.js -d "Two helper functions"
git diff | gh gist create -f changes.diff
gh gist create --public setup.sh
Notes
- "Secret" means unlisted, not private. Anyone with the link can read it.
- Do not put passwords or tokens in a gist. Treat anything you upload as leaked.
- Edit later with gh gist edit ID and list yours with gh gist list.
See also
Last reviewed 2026-10-09.