[为github创建私人访问令牌] #github

markdown
阅读 38 收藏 0 点赞 0 评论 0

Generating_Access_Token.md
# Generating Access Token

As of [2013-05-16](https://github.blog/2013-05-16-personal-api-tokens/), you can generate API Access Tokens via the Web UI or via the GitHub API.
**All other authorization methods is deprecated.**

## Web
* Account Settings -> [Personal access tokens](https://github.com/settings/tokens)
* "Generate new token" under "Personal access tokens"
* For "Token description" you should give it a meaningful name, Example: sublime gist
* Under "Select scopes" you can just select gist

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

## 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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号