.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "GIST" "1" "August 2020" "" "Gist manual" . .SH "NAME" \fBgist-paste\fR \- upload code to https://gist\.github\.com . .SH "Synopsis" The gist gem provides a \fBgist-paste\fR command that you can use from your terminal to upload content to https://gist\.github\.com/\. . .SH "Installation" . .IP "\(bu" 4 If you have ruby installed: . .IP gem install gist . .IP "\(bu" 4 If you\'re using Bundler: . .IP source :rubygems gem \'gist\' . .IP "\(bu" 4 For OS X, gist lives in Homebrew . .IP brew install gist . .IP "\(bu" 4 For FreeBSD, gist lives in ports . .IP pkg install gist . .IP "" 0 . .SH "Command" . .IP "\(bu" 4 To upload the contents of \fBa\.rb\fR just: . .IP gist-paste a\.rb . .IP "\(bu" 4 Upload multiple files: . .IP gist-paste a b c gist *\.rb . .IP "\(bu" 4 By default it reads from STDIN, and you can set a filename with \fB\-f\fR\. . .IP gist-paste \-f test\.rb ~/\.gist) . .fi . .IP "" 0 . .P The \fBumask\fR ensures that the file is only accessible from your user account\. . .SS "GitHub Enterprise" If you\'d like \fBgist-paste\fR to use your locally installed GitHub Enterprise \fIhttps://enterprise\.github\.com/\fR, you need to export the \fBGITHUB_URL\fR environment variable (usually done in your \fB~/\.bashrc\fR)\. . .IP "" 4 . .nf export GITHUB_URL=http://github\.internal\.example\.com/ . .fi . .IP "" 0 . .P Once you\'ve done this and restarted your terminal (or run \fBsource ~/\.bashrc\fR), gist-paste will automatically use GitHub Enterprise instead of the public github\.com . .P Your token for GitHub Enterprise will be stored in \fB\.gist\.\.[\.]\fR (e\.g\. \fB~/\.gist\.http\.github\.internal\.example\.com\fR for the GITHUB_URL example above) instead of \fB~/\.gist\fR\. . .P 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 \fBgist-paste\fR\. 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 \fBunset GITHUB_URL\fR . .SS "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: \fB$ gist-paste \-l Error: Bad credentials\fR . .TP You can also use Gist as a library from inside your ruby code: . .IP Gist\.gist("Look\.at(:my => \'awesome\')\.code") . .P If you need more advanced features you can also pass: . .IP "\(bu" 4 \fB:access_token\fR to authenticate using OAuth2 (default is `File\.read("~/\.gist"))\. . .IP "\(bu" 4 \fB:filename\fR to change the syntax highlighting (default is \fBa\.rb\fR)\. . .IP "\(bu" 4 \fB:public\fR if you want your gist to have a guessable url\. . .IP "\(bu" 4 \fB:description\fR to add a description to your gist\. . .IP "\(bu" 4 \fB:update\fR to update an existing gist (can be a URL or an id)\. . .IP "\(bu" 4 \fB:copy\fR to copy the resulting URL to the clipboard (default is false)\. . .IP "\(bu" 4 \fB:open\fR to open the resulting URL in a browser (default is false)\. . .IP "" 0 . .P NOTE: The access_token must have the \fBgist\fR scope and may also require the \fBuser:email\fR scope\. . .IP "\(bu" 4 If you want to upload multiple files in the same gist, you can: . .IP Gist\.multi_gist("a\.rb" => "Foo\.bar", "a\.py" => "Foo\.bar") . .IP "\(bu" 4 If you\'d rather use gist-paste\'s builtin access_token, then you can force the user to obtain one by calling: . .IP Gist\.login! . .IP "\(bu" 4 This will take them through the process of obtaining an OAuth2 token, and storing it in \fB~/\.gist\fR, where it can later be read by \fBGist\.gist\fR . .IP "" 0 . .SH "Configuration" . .IP "\(bu" 4 If you\'d like \fB\-o\fR or \fB\-c\fR to be the default when you use the gist-paste executable, add an alias to your \fB~/\.bashrc\fR (or equivalent)\. For example: . .IP alias gist=\'gist \-c\' . .IP "\(bu" 4 If you\'d prefer gist-paste to open a different browser, then you can export the BROWSER environment variable: . .IP export BROWSER=google\-chrome . .IP "" 0 . .P If clipboard or browser integration don\'t work on your platform, please file a bug or (more ideally) a pull request\. . .P If you need to use an HTTP proxy to access the internet, export the \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variable and gist-paste will use it\. . .SH "Meta\-fu" Thanks to @defunkt and @indirect for writing and maintaining versions 1 through 3\. Thanks to @rking and @ConradIrwin for maintaining version 4\. . .P Licensed under the MIT license\. Bug\-reports, and pull requests are welcome\.