gist
- gist on the command line
gist
[-p
] [-t extension
] FILE|-
gist
can be used to create gists on gist.github.com from the command
line. There are two primary methods of creating gists.
If standard input is supplied, it will be used as the content of the new gist. If FILE is provided, the content of that file will be used to create the gist. If FILE is '-' then gist will wait for content from standard input.
Once your gist is successfully created, the URL will be copied to your
clipboard. If you are on OS X, gist
will open the gist in your
browser, too.
gist
's default mode of operation is to read content from standard
input and create a public, text gist without description from it, tied
to your GitHub account if you user and passwordare provided (see
CONFIGURATION
).
These options can be used to change this behavior:
-p
, --private
Create a private gist instead of a public gist.
-t
, --type
Set the file extension explicitly. Passing a type of rb
ensures
the gist is created as a Ruby file.
-d
, --description
Set a description.
-o
, --[no-]open
Open the gist in your browser after creation. Or don't. Defaults to --open
You may additionally ask for help:
-h
, --help
Print help.
-m
, --man
Display this man page.
There are two ways to set GitHub user and password info:
Using environment vars GITHUB_USER and GITHUB_PASSWORD
$ export GITHUB_USER=johndoe
$ export GITHUB_PASSWORD=mysecretgithubpassword
$ gist ~/example
Using git-config(1)
Use git-config(1) to display the currently configured GitHub username:
$ git config --global github.user
Or, set the GitHub username with:
$ git config --global github.user <username>
See http://github.com/guides/local-github-config for more information.
You can set a few options in your git config (using git-config(1)) to control the default behavior of gist(1).
gist.private - boolean (yes or no) - Determines whether to make a gist private by default
gist.extension - string - Default extension for gists you create.
gist.browse - boolean (yes or no) - Whether to open the gist in your browser after creation. Default: yes
The following environment variables affect the execution of gist
:
$ gist < file.txt
$ echo secret | gist --private
$ echo "puts :hi" | gist -t rb
$ gist script.py
$ gist -
the quick brown fox jumps over the lazy dog
^D
http://github.com/defunkt/gist/issues
Chris Wanstrath :: chris@ozmm.org
hub(1), git(1), git-clone(1), http://github.com, http://github.com/defunkt/gist