Skip to content

Commit c12fe61

Browse files
committed
Merge branch 'revert-netrc'
2 parents 39aa1a2 + 0f03637 commit c12fe61

File tree

5 files changed

+21
-639
lines changed

5 files changed

+21
-639
lines changed

README.md

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -77,49 +77,24 @@ To read a gist and print it to STDOUT
7777

7878
‌See `gist --help` for more detail.
7979

80-
## Authentication
80+
## Login
8181

82-
To associate and manage uploaded gists with your GitHub account, `gist` needs an
83-
authentication token, with at least the "gist" permission. The token can be
84-
obtained using `gist --login`. Alternately, you may generate a personal access
85-
token through https://github.com/settings/tokens and save it in `~/.netrc`.
82+
If you want to associate your gists with your GitHub account, you need to login
83+
with gist. It doesn't store your username and password, it just uses them to get
84+
an OAuth2 token (with the "gist" permission).
8685

87-
### Authenticating with `gist --login`
88-
89-
Gist can login to your GitHub account. It doesn't store your Github username or
90-
password, it just uses them to get an OAuth2 token (with the "gist" permission).
91-
92-
$ gist --login
86+
gist --login
9387
Obtaining OAuth2 access_token from github.
9488
GitHub username: ConradIrwin
9589
GitHub password:
9690
2-factor auth code:
9791
Success! https://github.com/settings/tokens
9892

99-
This token is stored in `~/.gist` and used for all future gisting. The generated
100-
token will be listed in https://github.com/settings/tokens, and can also be
101-
revoked from there.
102-
103-
### Credentials in `~/.netrc`
104-
105-
Gist can make use of a personal token stored in `~/.netrc`. Github credentials
106-
stored in this file are matched by the hostname, and can be shared among
107-
different tools, like `git`, and `curl`.
108-
109-
The `~/.netrc` file should be unreadable by anyone except the owner. To store
110-
your gist token in `~/.netrc`, use the format:
93+
This token is stored in `~/.gist` and used for all future gisting. If you need to
94+
you can revoke it from https://github.com/settings/tokens, or just delete the
95+
file.
11196

112-
machine github.com
113-
password PERSONAL_ACCESS_TOKEN
114-
115-
You may also maintain a separate token exclusively for gisting by associating
116-
the token with the hostname `gist.github.com`, and setting the environment
117-
variable `GITHUB_URL=https://gist.github.com`.
118-
119-
### Uploading anonymous gists
120-
121-
Independently of the authentication mechanism used, you can always upload gists
122-
anonymously by using the `-a` option.
97+
‌After you've done this, you can still upload gists anonymously with `-a`.
12398

12499
gist -a a.rb
125100

@@ -128,19 +103,13 @@ anonymously by using the `-a` option.
128103
If you'd like `gist` to use your locally installed [GitHub Enterprise](https://enterprise.github.com/),
129104
you need to export the `GITHUB_URL` environment variable (usually done in your `~/.bashrc`).
130105

131-
export GITHUB_URL=https://github.internal.example.com/
106+
export GITHUB_URL=http://github.internal.example.com/
132107

133108
Once you've done this and restarted your terminal (or run `source ~/.bashrc`), gist will
134109
automatically use github enterprise instead of the public github.com
135110

136-
When using `gist --login` your token for GitHub Enterprise will be stored in
137-
`.gist.<protocol>.<server.name>[.<port>]` (e.g.
138-
`~.gist.https.github.internal.example.com` for the GITHUB_URL example above)
139-
instead of `~/.gist`. The token can also be stored in `~/.netrc` with an
140-
appropriate entry for the host. For instance, for the example above,
141-
142-
machine github.internal.example.com
143-
password GITHUB_ENTERPRISE_TOKEN
111+
Your token for GitHub Enterprise will be stored in `.gist.<protocol>.<server.name>[.<port>]` (e.g.
112+
`~.gist.http.github.internal.example.com` for the GITHUB_URL example above) instead of `~/.gist`.
144113

145114
If you have multiple servers or use Enterprise and public GitHub often, you can work around this by creating scripts
146115
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

Rakefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ task :standalone do
2323
f.puts "#!/usr/bin/env ruby"
2424
f.puts "# This is generated from https://github.com/defunkt/gist using 'rake standalone'"
2525
f.puts "# any changes will be overwritten."
26-
f.puts File.read("lib/gist.rb")
27-
.split("require 'json'\n").join(File.read("vendor/json.rb"))
28-
.split("require 'netrc'\n").join(File.read("vendor/netrc.rb"))
26+
f.puts File.read("lib/gist.rb").split("require 'json'\n").join(File.read("vendor/json.rb"))
2927

3028
f.puts File.read("bin/gist").gsub(/^require.*gist.*\n/, '');
3129
end

0 commit comments

Comments
 (0)