You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-6Lines changed: 24 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -84,9 +84,26 @@ To read a gist and print it to STDOUT
84
84
85
85
## Login
86
86
87
-
If you want to associate your gists with your GitHub account, you need to login
88
-
with gist. It doesn't store your username and password, it just uses them to get
89
-
an OAuth2 token (with the "gist" permission).
87
+
Before you use `gist` for the first time you will need to log in. There are two supported login flows:
88
+
89
+
1. The Github device-code Oauth flow. This is the default for authenticating to github.com, and can be enabled for Github Enterprise by creating an Oauth app, and exporting the environment variable `GIST_CLIENT_ID` with the client id of the Oauth app.
90
+
2. The (deprecated) username and password token exchange flow. This is the default for GitHub Enterprise, and can be used to log into github.com by exporting the environment variable `GIST_USE_USERNAME_AND_PASSWORD`.
91
+
92
+
### The device-code flow
93
+
94
+
This flow allows you to obtain a token by logging into GitHub in the browser and typing a verification code. This is the preferred mechanism.
The returned access_token is stored in `~/.gist` and used for all future gisting. If you need to you can revoke access from https://github.com/settings/connections/applications/4f7ec0d4eab38e74384e.
103
+
104
+
### The username-password flow
105
+
106
+
This flow asks for your GitHub username and password (and 2FA code), and exchanges them for a token with the "gist" permission (your username and password are not stored). This mechanism is deprecated by GitHub, but may still work with GitHub Enterprise.
90
107
91
108
gist --login
92
109
Obtaining OAuth2 access_token from GitHub.
@@ -102,8 +119,9 @@ file.
102
119
#### Password-less login
103
120
104
121
If you have a complicated authorization requirement you can manually create a
105
-
token file by pasting a GitHub token with only the `gist` permission into a
106
-
file called `~/.gist`. You can create one from https://github.com/settings/tokens
122
+
token file by pasting a GitHub token with `gist` scope (and maybe the `user:email`
123
+
for GitHub Enterprise) into a file called `~/.gist`. You can create one from
124
+
https://github.com/settings/tokens
107
125
108
126
This file should contain only the token (~40 hex characters), and to make it
109
127
easier to edit, can optionally have a final newline (`\n` or `\r\n`).
@@ -156,7 +174,7 @@ If you need more advanced features you can also pass:
156
174
*`:copy` to copy the resulting URL to the clipboard (default is false).
157
175
*`:open` to open the resulting URL in a browser (default is false).
158
176
159
-
NOTE: The access_token must have the "gist" scope.
177
+
NOTE: The access_token must have the `gist` scope and may also require the `user:email` scope.
160
178
161
179
If you want to upload multiple files in the same gist, you can:
0 commit comments