Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git/github command line app that uses oauth tokens to authenticate?

I wish to use a simple command line client (such as the official git client) to clone branches from github as part of a deploy tool.

For security, I do not wish to use basic (username/password) authentication. As I am already using github's oauth-token based Auth headers in my app, I was wondering if there is a command-line app that can use oauth tokens to authenticate to github.

Thanks!

like image 612
mikemaccana Avatar asked Jan 28 '26 07:01

mikemaccana


1 Answers

Update Sep 2012

Github now accepts the use of auth tokens using any git client.

You can get a oauth token for github using these instructions, here's a practical demo using Node.js and superagent.

var GITHUB_API_ENDPOINT = 'https://api.github.com/'

superagent
  .post(GITHUB_API_ENDPOINT+'authorizations')
  .auth('username', 'notactuallymypassword')
  .send({ scopes: 'repo', note: 'Social Ops Deployer' })
  .end(function(res){
    if (res.ok) {
     console.log('yay got ' + JSON.stringify(res.body));
    } else {
     console.log('Oh no! error ' + res.text);
    }
  });
like image 101
mikemaccana Avatar answered Jan 30 '26 04:01

mikemaccana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!