Last active
August 29, 2015 13:55
-
-
Save gary/8720313 to your computer and use it in GitHub Desktop.
Login to the GitHub API with 2fa and netrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine api.github.com | |
login # your GitHub username | |
password # your GitHub password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = Octokit::Client.new netrc: true | |
t = c.create_authorization(scopes: ['user'], headers: { 'X-GitHub-OTP' => 'XXXXXX' }) # with your 2 factor code | |
c = Octokit::Client.new access_token: t.token | |
c.user # => should be you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment