GIST(1) Gist manual GIST(1) NAME gist - upload code to https://gist.github.com Synopsis The gist gem provides a gist command that you can use from your terminal to upload content to https://gist.github.com/. Installation o If you have ruby installed: gem install gist o If you're using Bundler: source :rubygems gem 'gist' o For OS X, gist lives in Homebrew brew install gist o For FreeBSD, gist lives in ports pkg install gist o For Ubuntu/Debian apt install gist Note: Debian renames the binary to gist-paste to avoid a name conflict. Command o To upload the contents of a.rb just: gist a.rb o Upload multiple files: gist a b c gist *.rb o By default it reads from STDIN, and you can set a filename with -f. gist -f test.rb ~/.gist) The umask ensures that the file is only accessible from your user account. GitHub Enterprise If you'd like gist to use your locally installed GitHub Enterprise https://enterprise.github.com/, you need to export the GITHUB_URL environment variable (usually done in your ~/.bashrc). export GITHUB_URL=http://github.internal.example.com/ Once you've done this and restarted your terminal (or run source ~/.bashrc), gist will automatically use GitHub Enterprise instead of the public github.com Your token for GitHub Enterprise will be stored in .gist..[.] (e.g. ~/.gist.http.github.internal.example.com for the GITHUB_URL example above) instead of ~/.gist. If you have multiple servers or use Enterprise and public GitHub often, you can work around this by creating scripts that set the env var and then run gist. Keep in mind that to use the public GitHub you must unset the env var. Just setting it to the public URL will not work. Use unset GITHUB_URL Token file format If you cannot use passwords, as most Enterprise installations do, you can generate the token via the web interface and then simply save the string in the correct file. Avoid line breaks or you might see: $ gist -l Error: Bad credentials You can also use Gist as a library from inside your ruby code: If you need more advanced features you can also pass: o :access_token to authenticate using OAuth2 (default is `File.read("~/.gist")). o :filename to change the syntax highlighting (default is a.rb). o :public if you want your gist to have a guessable url. o :description to add a description to your gist. o :update to update an existing gist (can be a URL or an id). o :copy to copy the resulting URL to the clipboard (default is false). o :open to open the resulting URL in a browser (default is false). NOTE: The access_token must have the gist scope and may also require the user:email scope. o If you want to upload multiple files in the same gist, you can: Gist.multi_gist("a.rb" => "Foo.bar", "a.py" => "Foo.bar") o If you'd rather use gist's builtin access_token, then you can force the user to obtain one by calling: Gist.login! o This will take them through the process of obtaining an OAuth2 token, and storing it in ~/.gist, where it can later be read by Gist.gist Configuration o If you'd like -o or -c to be the default when you use the gist executable, add an alias to your ~/.bashrc (or equivalent). For example: alias gist='gist -c' o If you'd prefer gist to open a different browser, then you can export the BROWSER environment variable: export BROWSER=google-chrome If clipboard or browser integration don't work on your platform, please file a bug or (more ideally) a pull request. If you need to use an HTTP proxy to access the internet, export the HTTP_PROXY or http_proxy environment variable and gist will use it. Meta-fu Thanks to @defunkt and @indirect for writing and maintaining versions 1 through 3. Thanks to @rking and @ConradIrwin for maintaining version 4. Licensed under the MIT license. Bug-reports, and pull requests are welcome. July 2026 GIST(1)