Skip to content

Cred.sshKeyNew not working: Too many redirects or authentication replays #511

Closed

Description

@dcodeIO

Hello everyone,

I am trying to automate pushing to a GitHub repository using NodeGit.Cred.sshKeyNew, but it looks like I am not able to get this working somehow. NodeGit.Cred.userpassPlaintextNew works just fine.

This is what I have:

}).then(function(remoteResult) {
    remote = remoteResult;
    remote.setCallbacks({
        credentials: function(url, userName) {
            return nodegit.Cred.sshKeyNew(
                userName,
                path.join(__dirname, "..", "..", "data", "mykey-rsa.pub"),
                path.join(__dirname, "..", "..", "data", "mykey-rsa"),
                "myPass"
            );
        }
    });
    return remote.connect(nodegit.Enums.DIRECTION.PUSH);
})

Which always results in: Error: Too many redirects or authentication replays.

I did double check that:

  • paths to the public and private key files are correct
  • the key is properly installed on GitHub
  • the key has been generated with ssh-keygen -t rsa
  • the key's password is correct

Am I doing something wrong there?

Activity

  1. tbranyen commented on Mar 24, 2015

    @tbranyen
    Member
  2. dcodeIO commented on Mar 24, 2015

    @dcodeIO
    Author

    Yes, looked over the test cases as well. If you intended to hint me at something, I'd be grateful for an explanation.

  3. tbranyen commented on Mar 24, 2015

    @tbranyen
    Member

    @dcodeIO the only hint there is that it's a working example, unfortunately with the code you provided I don't know what the bug is. Maybe try asking in the #libgit2 channel on IRC?

  4. mikalai-s commented on Apr 14, 2015

    @mikalai-s

    I used to have the same issue... In my case remote URL was set to https instead of ssh.

  5. johnhaley81 commented on Apr 14, 2015

    @johnhaley81
    Collaborator

    @dcodeIO I think that @mikalai-silivonik is correct. If you're using NodeGit.Cred.userpassPlaintextNew and that's working then you're not using SSH and no SSH key in the world is going to authenticate you into an HTTPS session. Try switching protocols.

  6. dcodeIO commented on Apr 14, 2015

    @dcodeIO
    Author

    Stupid me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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