@@ -92,14 +92,38 @@ an OAuth2 token (with the "gist" permission).
9292
9393This token is stored in ` ~/.gist ` and used for all future gisting. If you need to
9494you can revoke it from https://github.com/settings/tokens , or just delete the
95- file. If you need to store tokens for both github.com and a Github Enterprise instance
96- you can save your Github Enterprise token in ` ~/.gist.github.example.com ` where
97- "github.example.com" is the URL for your Github Enterprise instance.
95+ file.
9896
9997After you've done this, you can still upload gists anonymously with ` -a ` .
10098
10199 gist -a a.rb
102100
101+ ### GitHub Enterprise
102+
103+ If you'd like ` gist ` to use your locally installed [ GitHub Enterprise] ( https://enterprise.github.com/ ) ,
104+ you need to export the ` GITHUB_URL ` environment variable (usually done in your ` ~/.bashrc ` ).
105+
106+ export GITHUB_URL=http://github.internal.example.com/
107+
108+ Once you've done this and restarted your terminal (or run ` source ~/.bashrc ` ), gist will
109+ automatically use github enterprise instead of the public github.com
110+
111+ Your token for GitHub Enterprise will be stored in ` .gist.<protocol><server.name> ` (e.g.
112+ ` ~.gist.httpgithub.internal.example.com ` for the GITHUB_URL example above) instead of ` ~/.gist ` .
113+
114+ If you have multiple servers or use Enterprise and public GitHub often, you can work around this by creating scripts
115+ that set the env var and then run ` gist ` . Keep in mind that to use the public GitHub you must unset the env var. Just
116+ setting it to the public URL will not work. Use ` unset GITHUB_URL `
117+
118+ ### Token file format
119+
120+ If you cannot use passwords, as most Enterprise instalations do, you can generate the token via the web interface
121+ and then simply save the string in the correct file. Avoid line breaks or you migth see:
122+ ```
123+ $ gist -l
124+ Error: Bad credentials
125+ ```
126+
103127# Library
104128
105129You can also use Gist as a library from inside your ruby code:
@@ -131,16 +155,6 @@ NOTE: The access_token must have the "gist" scope.
131155This will take them through the process of obtaining an OAuth2 token, and storing it
132156in ` ~/.gist ` , where it can later be read by ` Gist.gist `
133157
134- ## GitHub enterprise
135-
136- If you'd like ` gist ` to use your locally installed [ GitHub Enterprise] ( https://enterprise.github.com/ ) ,
137- you need to export the ` GITHUB_URL ` environment variable in your ` ~/.bashrc ` .
138-
139- export GITHUB_URL=http://github.internal.example.com/
140-
141- Once you've done this and restarted your terminal (or run ` source ~/.bashrc ` ), gist will
142- automatically use github enterprise instead of the public github.com
143-
144158## Configuration
145159
146160If you'd like ` -o ` or ` -c ` to be the default when you use the gist executable, add an
0 commit comments