How to create a GitHub Gist
On GitHub (verified 2026-10-24), open https://gist.github.com while signed in, enter a description, add a filename with extension (for example demo.py), paste the code, choose Create public gist or Create secret gist, and save. You get a URL to share; secret gists are unlisted (not private encryption) — anyone with the link can view them.
Gists are ideal for repro snippets, config samples and tiny scripts. Multi-file gists keep related files together. For real projects with issues and PRs, create a repository instead.
Applies to GitHub.com (and Enterprise when Gist is enabled). You need a GitHub account. Secret ≠ private: treat secret gists as shareable links, not vault storage.
Publish a public or secret Gist
Open the Gist editor
- Sign in to GitHub.
- Go to https://gist.github.com (or profile menu → Your gists → New).
- Add an optional description.
Add files
- Enter a filename including the extension so syntax highlighting works.
- Paste the snippet.
- Optional: Add file for a second related file in the same gist.
Create and share
- Click Create public gist or Create secret gist.
- Copy the gist URL to share.
- Optional: clone with the git URL on the gist page if you will iterate locally.
Our take: secret for drafts, public for teaching
Public gists are discoverable; secret gists are fine for a quick Slack paste but never for passwords or tokens.
If it fails
- Create button disabled: empty filename or empty file body — fill both.
- Secret gist still leaked: anyone with the URL can open it; revoke by deleting the gist.
- Need reviewers/PRs: promote the work to a proper repository.
- Enterprise gist disabled: ask your admin — some orgs turn Gist off.
Frequently asked questions
What is a GitHub Gist?
A lightweight snippet host on GitHub for one or more files with a shareable URL and optional git access.
Public vs secret gist?
Public gists can appear in discovery/search; secret gists are unlisted but viewable by anyone who has the link.
Can a gist have multiple files?
Yes — use Add file before creating the gist.
Are secret gists private?
No — they are secret/unlisted, not access-controlled private repos. Do not store credentials.
How do I edit a gist later?
Open the gist → Edit → change files → Update.