With gists, you can share single files, parts of files, and full applications with other people. Directories can't be shared. You can access your gists at http(s)://[hostname]/gist
, or http(s)://gist.[hostname]
if subdomains are enabled.
Every gist is a Git repository, which means that it can be forked and cloned. The gist editor is powered by CodeMirror.
Types of gists
There are two types of gists: public gists and secret gists. For steps on creating gists, see "Creating gists."
Public gists
Public gists show up in Discover, http(s)://[hostname]/gist/discover
or http(s)://gist.[hostname]/discover
if subdomains are enabled, where people can browse new gists as they're created. They're also searchable, so you can use them if you'd like other people to find and see your work. After creating a gist, you cannot convert it from public to secret.
Secret gists
Secret gists don't show up in Discover, http(s)://[hostname]/gist/discover
or http(s)://gist.[hostname]/discover
if subdomains are enabled, and are not searchable. Use them to jot down an idea that came to you in a dream, create a to-do list, or prepare some code or prose that's not ready to be shared with the world. After creating a gist, you cannot convert it from public to secret.
Secret gists aren't private. If you send the URL of a secret gist to a friend, they'll be able to see it. However, if someone you don't know discovers the URL, they'll also be able to see your gist. If you need to keep your code away from prying eyes, you may want to create a private repository instead.
Anonymous gists
If your site administrator has disabled private mode, you can also use anonymous gists, which can be public or secret.
Warning: Anonymous gists cannot be deleted from the web browser. To have an anonymous gist deleted, contact your GitHub Enterprise site administrator. Please provide the URL of the gist you wish to delete.
Discovering and searching for other people's gists
You can discover gists others have created by going to the gist home page, http(s)://[hostname]/gist
or http(s)://gist.[hostname]
if subdomains are enabled and clicking All Gists. This will take you to a page of all gists sorted and displayed by time of creation or update. You can also search gists by language with Gist Search, http(s)://[hostname]/gist/search
or http(s)://gist.[hostname]/search
if subdomains are enabled. Gist search uses the same search syntax as code search.
Forking and cloning gists
Since gists are Git repositories, you can view their full commit history, complete with diffs. You can also fork or clone gists. For more information, see "Forking and cloning gists".
Downloading gists
You can download a ZIP file of a gist by clicking the Download ZIP button at the top of the gist.
Embedding gists
You can embed a gist in any text field that supports Javascript, such as a blog post. To get the embed code, click the clipboard icon next to the Embed URL of a gist.
To embed a specific gist file, append the Embed URL with ?file=FILENAME
.