Skip to content

Instantly share code, notes, and snippets.

@maboloshi
Last active February 18, 2019 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maboloshi/55ceac463fafc09611aeb1951bfb7421 to your computer and use it in GitHub Desktop.
Save maboloshi/55ceac463fafc09611aeb1951bfb7421 to your computer and use it in GitHub Desktop.
[为github创建私人访问令牌] #github

Generating Access Token

As of 2013-05-16, you can generate API Access Tokens via the Web UI or via the GitHub API. All other authorization methods is deprecated.

Web

Paste the token in the settings section under the token option.

url中的空格符 使用+代替.

API

Here's a command you can run from your terminal to generate a token via curl:

curl -i -u USERNAME https://api.github.com/authorizations --data '{"scopes":["gist"],"note":"SublimeText 2/3 Gist plugin"}'

Where USERNAME is your Github username. Save the token generated and paste it in the settings section under the token option.

If OTP is enabled on your account, this will return 401 error code, use:

curl -i -u USERNAME -H "X-GitHub-OTP: OTPCODE" https://api.github.com/authorizations --data '{"scopes":["gist"],"note":"SublimeText 2/3 Gist plugin"}'

Where OTPCODE is the code your authenticator app shows you.

摘取至: https://github.com/condemil/Gist/blob/master/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment