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
Does the Gist automatically pick up the type of file (i.e. Shell, Markdown etc)?