Scott Oaks created NETBEANS-5852:
------------------------------------

             Summary: GIT clone inexplicably fails on MAC: Incorrect 
Credentials even though credentials are valid
                 Key: NETBEANS-5852
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5852
             Project: NetBeans
          Issue Type: Bug
          Components: versioncontrol - Git
    Affects Versions: 12.4
            Reporter: Scott Oaks


Trying to git clone a repository on my Mac, using credentials (user/private 
key) that work from the git command line, and I continually get 

Incorrect credentials for repository at ...

There is no other information to help me here, which is the first problem. It 
would be very helpful to print out the stack trace to let me know more about 
the kind of problem I've encountered.

Eventually I resorted to building netbeans myself so I could insert the needed 
diagnostics, which were that the Jsch didn't like my private key:
{code:java}
     [exec] Caused by: com.jcraft.jsch.JSchException: invalid privatekey: 
[B@3e2f8dbf
     [exec]     at com.jcraft.jsch.KeyPair.load(KeyPair.java:664)
     [exec]     at com.jcraft.jsch.KeyPair.load(KeyPair.java:561)
     [exec]     at 
com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
     [exec]     at com.jcraft.jsch.JSch.addIdentity(JSch.java:406)
     [exec]     at com.jcraft.jsch.JSch.addIdentity(JSch.java:366)
     [exec]     at 
org.netbeans.libs.git.jgit.JGitSshSessionFactory.setupJSchIdentityRepository(JGitSshSessionFactory.java:184)
     [exec]     at 
org.netbeans.libs.git.jgit.JGitSshSessionFactory.setupJSch(JGitSshSessionFactory.java:197)
     [exec]     ... 28 more {code}
A little more research and I discovered that JSch doesn't like keys with the 
header of

-----BEGIN OPENSSH PRIVATE KEY-----

Instead they require

-----BEGIN RSA PRIVATE KEY-----

Mac key generation defaults to the first one; the second can be forced by 
generating keys with

ssh-keygen -t rsa -m PEM

And so using that key works. 

So two things:
1) Better diagnostics in failure case

2) Support all valid keys on mac (especially the default key)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to