command line tool to sync github gists

View the Project on GitHub weakish/gister


gister is a command line tool for managing GitHub gists.

Based on gist.rb by @defunkt, this tool helps you to manage a local copy of your gists.

After publishing files to, this tool will:

You can also use gister to sync your gists (created and starred) between and your machine.


For Linux, BSD, etc, you also need xclip or xsel. For Cygwin, you need putclip/getclip provided by cygutils-extra. (Mas OS X users should be fine with the preinstalled pbcopy/pbpaste.)

Mac OS X users also need GNU versions of sed and date, a.k.a gsed and gdate.

Note: xsel users should use gist.rb v4.1.2+, since there is a bug bitting xsel users in previous versions.

Optional Dependencies


Note that the following instructions only install gister itself. You need to install its dependencies mentioned before yourself.

With basher

; basher install weakish/gister

Requires basher version: >=39875bc.

To uninstall:

; basher uninstall weakish/gister

With make

git clone
cd gister
make install

To uninstall:

; cd gister
; make uninstall



For the first time, you need to run gister init to associate your GitHub account and configure the directory to store local copies of your gists.

After that, you may run gister sync to fetch all your gists (created and starred) to local.

Warn: sync can only fetch up to 10 million gists for you. If you have more than 10 million gists, you need to modify the source of gister to lift the limit.


GISTER_USE_HTTPS: If you need to use https for some reason, set the env var GISTER_USE_HTTPS, but please note this isn’t necessarily more secure than ssh, it’s just a different option in case your network blocks all traffic other than http/s.

GISTER_AUTO_COMMIT: If you’d like the sync command to automatically commit any local changes you’ve made before pulling and pushing to, set the GISTER_AUTO_COMMIT env var to anything.


Whenever you want to publish a gist, just use

gister description file.txt ...

This will create the gist with the provided description, clone the gist repo, and put the gistid to clipborad.

Note: you must provide gist description, otherwise gister will fail.

Hint: gister will pass all arguments to gist as gist -c -o -d description ..., so you can use other options that gist understands, e.g. gister description -P will work.

If you’ve edited your gists at or local machine, without pull/push changesets, you can sync all your gists via gister sync.

If you’ve deleted your gists at, after gister sync, the directories of deleted gists at your local machine will be marked with a prefix _.

Search all of your gists:

gister search regexp

If codesearch is installed, regexp is RE2 (nearly PCRE). Otherwise it is ERE, a.k.a grep -E.


Export a gist (available at local) to a git repository, with its full history:

; cd git-repo-root
; gister export gist_id sub_directory_name branch_name

The content of the gist will be exported to sub_directory_name, and the merging message will uses branch_name.


From version 1.0.0, gister uses a different storage structure. If you have used gister <1.0.0, then you need to run this command to migrate:

gister migrate


|-- gists.list  # a list of all your gists (including meta info)
|-- repo # git repositories of your gists
|-- tree # working directory of your gist repositories
    |-- 123456 # an example of gist
    |-- _123567890 # an example of gist which you have deleted on
    |-- ...
`-- .csearchindex # code search index (optional)


Send pull requests or issues at: