Skip to content

2 Step Authentication #323

@johngeorgewright

Description

@johngeorgewright

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions