Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jiuks/5150986 to your computer and use it in GitHub Desktop.
Save jiuks/5150986 to your computer and use it in GitHub Desktop.

Gists are a feature of git, and a nice way to share snippets of code or short documents. They benefit from being private or public, and can be cloned etc like standard git repositories.

To post a git from the command line there is a tool available called gist, installed with brew:

brew install gist

Then set your git username + password:

git config --global github.user "jbloggs"
git config --global github.password "welcome1"

Then pass gist the content to post, either on stdin or as a file:

gist filetopost.sh

Optionally specify the file type for appropriate syntax/markup :

gist -t md myfile.txt 

Available Options

gist.private - boolean (yes or no) - Determines whether to make a gist private by default

git config --global gist.prviate yes

gist.extension - string - Default extension for gists you create.

git config --global gist.extension md

gist.browse - boolean (yes or no) - Whether to open the gist in your browser after creation. Default: yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment