Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 Step Authentication #323

Closed
johngeorgewright opened this issue Dec 8, 2014 · 3 comments
Closed

2 Step Authentication #323

johngeorgewright opened this issue Dec 8, 2014 · 3 comments

Comments

@johngeorgewright
Copy link

A little reminder for people who are using 2 step authentication (I lost a fair while to this 😞 ). You will not be able to use anything other than a SSH connection when using nodegit to operate remotely. If you're finding that any remote operations are just hanging, this is most likely the cause.

Example:

var nodegit = require('nodegit'),
    clone = nodegit.Clone.clone,
    userpassPlaintextNew = nodegit.Cred.userpassPlaintextNew,
    user = 'my-user-name',
    pass = 'a-very-secret-password', 
    path = '/tmp/somewhere',
    options = {
      remoteCallbacks: {
        credentials: function () {
          return userpassPlaintextNew(user, pass);
        }
      }
    };

function url() {
    var url = 'https://'
    url += encodeURIComponent(user);
    url += ':';
    url += encodeURIComponent(pass);
    url += '@github.com/some-user/some-project.git',
    return url;
}

clone(url(), path, options)
  .then(function (repo) {
    console.log('IF YOU\'RE USING 2 STEP AUTH THIS WILL NEVER HAPPEN!');
  });

It's very difficult for automated services to get by 2 step authentication...that's why it's there. I'd recommend using other credentials until there's support for some kind of manual intervention.

@tbranyen
Copy link
Member

tbranyen commented Dec 8, 2014

I just tested this with a private repository on my GitHub account (two-way auth). I'm not sure why, but I received a segfault, never saw it even hit the credentials callback.

@maxkorp
Copy link
Collaborator

maxkorp commented Dec 8, 2014

O.o

I can't find anything about 2factor anywhere in the libgit2 docs, or on stack overflow, including searching for libgit2csharp and rugged. We might have to get in touch with them...

@maxkorp
Copy link
Collaborator

maxkorp commented Jan 30, 2015

Added an example from this which should be on master soon of how to get this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants