This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Cannot connect to remote repositories with just ssh public/private keys | ||
---|---|---|---|
Product: | versioncontrol | Reporter: | Ondrej Vrabec <ovrabec> |
Component: | Git | Assignee: | Ondrej Vrabec <ovrabec> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | alin.costea, anebuzelsky, git, hubik.tomas, jupeter, lazyguru, rebizu |
Priority: | P3 | ||
Version: | 7.0.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Messages log file |
Description
Ondrej Vrabec
2011-06-08 12:14:35 UTC
I get this for both https and ssh attempts to connect to github: 401 Authorization Required This is despite the fact that I have put in the proper credentials. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/c4ab635b1b79 User: Ondrej Vrabec <ovrabec@netbeans.org> Log: Issue #199263 - Cannot connect to remote repositories with just ssh public/private keys I was able to push to java.net with private/public ssh keys. I guess github behaves the same, but i cannot check since i am behind proxy. Someone please verify SSH connection works. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/b83c110776d5 User: Ondrej Vrabec <ovrabec@netbeans.org> Log: #199263 - Cannot connect to remote repositories with just ssh public/private keys URL should be trimmed *** Bug 201505 has been marked as a duplicate of this bug. *** I'm not sure I know how to patch the plugin with this code to test. (In reply to comment #7) > I'm not sure I know how to patch the plugin with this code to test. You need to download and try a dev build; http://bits.netbeans.org/download/trunk/nightly/latest/ I just downloaded the latest dev version. I used a Github URL, similar to the orginal bug report and setup public/private key access within Netbeans. When I tried to Clone the repository, I received this error "invalid privatekey:" with a reference to the private key location. I tried this after using a private key both with and without a password and received the same result. I am using PuttyGen to create the keys. (In reply to comment #9) Please attach the message log, there should be more info regarding the error. And let me know the type of the private key: paste the header here, e.g.:
> -----BEGIN DSA PRIVATE KEY-----
> Proc-Type: 4,ENCRYPTED
> DEK-Info: AES-128-CBC,E2112EB163340654D6DE14EA435ADD82
Looking into the code it seems that jsch lib thinks your key is different from DSA and RSA.
I tried both RSA and DSA keys generated from PuttyGen. Here is the header of the SSH-2 DSA private key file with no password: PuTTY-User-Key-File-2: ssh-dss Encryption: none Comment: dsa-key-20110905 Public-Lines: 10 ... Here is a the header from the RSA key: PuTTY-User-Key-File-2: ssh-rsa Encryption: none Comment: rsa-key-20110905 Public-Lines: 4 AAAAB3NzaC1yc2EAAAABJQAAAIBapuPpBoVMJDzcz2WKWzNXy/TJVdOCwn9jTFhW meeaG4CX1OrNypF4BIVriTuWmOdW0QH/oQMhWmQjjs20XHd4PopZB2Hg2s1ntq/A g/fakzR4Rc1/5FEOd/4dGjGbibkiC3nsELvmBkbf2YVY0+JeHTG3XRs4J0P+Rs7T OL8ZaQ== Private-Lines: 8 .... Here is the message log data: INFO [org.netbeans.modules.git]: git@github.com:user105/html5-boilerplate.git: invalid privatekey: C:\Users\user105\github.ppk com.jcraft.jsch.JSchException: invalid privatekey: C:\Users\user105\github.ppk at com.jcraft.jsch.IdentityFile.<init>(IdentityFile.java:261) at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:135) at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:130) at com.jcraft.jsch.JSch.addIdentity(JSch.java:206) at com.jcraft.jsch.JSch.addIdentity(JSch.java:192) at org.netbeans.libs.git.jgit.JGitSshSessionFactory.getSession(JGitSshSessionFactory.java:99) Caused: org.eclipse.jgit.errors.TransportException: git@github.com:user105/html5-boilerplate.git: invalid privatekey: C:\Users\user105\github.ppk at org.netbeans.libs.git.jgit.JGitSshSessionFactory.getSession(JGitSshSessionFactory.java:101) at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147) at org.netbeans.libs.git.jgit.commands.ListRemoteObjectsCommand.run(ListRemoteObjectsCommand.java:72) Caused: org.netbeans.libs.git.GitException$AuthorizationException: git@github.com:user105/html5-boilerplate.git: invalid privatekey: C:\Users\user105\github.ppk at org.netbeans.libs.git.jgit.commands.TransportCommand.handleException(TransportCommand.java:159) at org.netbeans.libs.git.jgit.commands.ListRemoteObjectsCommand.run(ListRemoteObjectsCommand.java:79) at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:68) at org.netbeans.libs.git.jgit.JGitClient.listRemoteBranches(JGitClient.java:414) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.netbeans.modules.git.client.GitClientInvocationHandler.invokeClientMethod(GitClientInvocationHandler.java:259) at org.netbeans.modules.git.client.GitClientInvocationHandler.access$400(GitClientInvocationHandler.java:65) at org.netbeans.modules.git.client.GitClientInvocationHandler$1.call(GitClientInvocationHandler.java:211) at org.netbeans.modules.git.client.GitClientInvocationHandler.invokeIntern(GitClientInvocationHandler.java:243) at org.netbeans.modules.git.client.GitClientInvocationHandler.invoke(GitClientInvocationHandler.java:191) at $Proxy24.listRemoteBranches(Unknown Source) [catch] at org.netbeans.modules.git.ui.clone.RepositoryStep$RepositoryStepProgressSupport.perform(RepositoryStep.java:190) at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:101) at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:94) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1424) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1973) (In reply to comment #12) > PuTTY-User-Key-File-2: ssh-dss > Encryption: none > Comment: dsa-key-20110905 > Public-Lines: 10 PuTTY format won't work in NetBeans, you'll need to export the keys to the OpenSSH format which JSCh understands. Thanks ovrabec! I was able to use PuttyGen to create an SSH-2 RSA key with no password and it worked with Github and Beanstalkapp when I went to Conversions > Export OpenSSH key in PuttyGen and used that private key. Oddly, when I tried to add a password to the key and export it using PuttyGen, in Netbeans I received an Auth Failed error. It is now working well enough for me to use, but just in case this Auth Failed issue is worth looking into, here is the error from the message log: com.jcraft.jsch.JSchException: Auth cancel at com.jcraft.jsch.Session.connect(Session.java:460) at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:128) Caused: org.eclipse.jgit.errors.TransportException: git@github.com:user105/html5-boilerplate.git: Auth cancel at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:138) at org.netbeans.libs.git.jgit.JGitSshSessionFactory.getSession(JGitSshSessionFactory.java:105) at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147) at org.netbeans.libs.git.jgit.commands.ListRemoteObjectsCommand.run(ListRemoteObjectsCommand.java:72) Caused: org.netbeans.libs.git.GitException$AuthorizationException: git@github.com:user105/html5-boilerplate.git: Auth cancel at org.netbeans.libs.git.jgit.commands.TransportCommand.handleException(TransportCommand.java:157) at org.netbeans.libs.git.jgit.commands.ListRemoteObjectsCommand.run(ListRemoteObjectsCommand.java:79) at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:68) at org.netbeans.libs.git.jgit.JGitClient.listRemoteBranches(JGitClient.java:414) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.netbeans.modules.git.client.GitClientInvocationHandler.invokeClientMethod(GitClientInvocationHandler.java:259) at org.netbeans.modules.git.client.GitClientInvocationHandler.access$400(GitClientInvocationHandler.java:65) at org.netbeans.modules.git.client.GitClientInvocationHandler$1.call(GitClientInvocationHandler.java:211) at org.netbeans.modules.git.client.GitClientInvocationHandler.invokeIntern(GitClientInvocationHandler.java:243) at org.netbeans.modules.git.client.GitClientInvocationHandler.invoke(GitClientInvocationHandler.java:191) at $Proxy24.listRemoteBranches(Unknown Source) [catch] at org.netbeans.modules.git.ui.clone.RepositoryStep$RepositoryStepProgressSupport.perform(RepositoryStep.java:190) at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:101) at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:94) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1424) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1973) > It is now working well enough for me to use, but just in case this Auth Failed
> issue is worth looking into, here is the error from the message log:
That's probably because jsch failed to unlock the private key. Did you try to connect with the same file (in OpenSSH format) on commandline?
I didn't actually try it on the command line, so I'm not sure about the results there. Using an SSH key with no passphrase worked for me too. Using one WITH a passphrase . . . not so much. Also, there is a visual anomaly on mine where if I click on the keys option, the file name and passphrase box don't show up. I have to drag the bottom of the window down to see it. *** Bug 205850 has been marked as a duplicate of this bug. *** Not sure why it would be acceptable to mark this as resolved when you can't connect with a private key that has a passphrase. Removing the passphrase from a private key is moronic and goes against any security recommendations (it's like locking your house door, but leaving the key in the door). I am seeing this issue in 7.1 (Build 201112071828) on Mac. I am connecting to a repository via SSH and a private key with a passphrase. Let me know what other details you need to track down and resolve this issue. (In reply to comment #19) I don't know what makes you think we support only ssh keys with empty passphrase. That's not true, i connect to github successfully with a identity file protected with a passphrase. If you can't, attach the messages log with the detailed error description. Created attachment 115849 [details]
Messages log file
This: http://netbeans.org/bugzilla/show_bug.cgi?id=199263#c17 and this: http://netbeans.org/bugzilla/show_bug.cgi?id=199263#c14 and this: http://netbeans.org/bugzilla/show_bug.cgi?id=205850#c2 And the fact the ticket was closed with no comments about it working with passphrases are what lead me to that conclusion (whether it was accurate or not). I've attached the relevant part of the message log. The /var/log/secure file from the server reports this message: Feb 16 22:46:46 myhost sshd[3866]: Received disconnect from X.X.X.X: 3: com.jcraft.jsch.JSchException: Auth cancel I'm not sure why, but now it is working. It seems to be fixed in Netbeans 7.2 RC1 Sorry for reopening this issue, but I still have this issue with nb 7.2 and 7.3 beta. I'm using ssh with key (exported puttygen key /w password). I'm using Git Extensions and 'git flow' in parallel. After cloning the repo nb git(hub) integration works well for some time, but after a while I get the message "Cannot connect to the remote repository at git@github.com:torstenfeld/ghrello.git I got the same issue on connection to github:enterprise. (In reply to comment #25) > Sorry for reopening this issue, but I still have this issue with nb 7.2 and 7.3 > beta. > > I'm using ssh with key (exported puttygen key /w password). I'm using Git > Extensions and 'git flow' in parallel. After cloning the repo nb git(hub) > integration works well for some time, but after a while I get the message > "Cannot connect to the remote repository at > git@github.com:torstenfeld/ghrello.git > > I got the same issue on connection to github:enterprise. Are you sure the key is exported in OpenSSH format? Did you double check that you entered "git" into the username field? > integration works well for some time what does this mean? Can you pull, push, fetch?? > but after a while I get the message > "Cannot connect to the remote repository at > git@github.com:torstenfeld/ghrello.git attach the full messages.log with the error anyway, file another bug for your issue. I believe this is really fixed - no one has reopened this with valid foundations for over a year - your problem will probably lie somewhere else and let's not pollute this issue any more trying to connect but got /// slashed - why not // ? http://d.pr/i/YJXg (In reply to comment #28) > trying to connect but got /// slashed - why not // ? > http://d.pr/i/YJXg We (JGit to be precise) do not support this kind of URL: #226607. Use git@dev:repositories/wl2 I have the similar problem. I am trying to connect to my gitolite repository through ssh on Windows 7, NetBeans 7.3. My server is running gitolite3 v3.5-0-g4071623 on git 1.7.1. When connecting through Git Extensions, everything works without any problem. When trying to connect through NetBeans, I get some errors. URL: redmine.domain.cz:repodir/repo_1.git Username: git Private key: D:\Dokumenty\Keys\user.ppk Clone: Error: git@redmine.domain.cz:repodir/repo_1.git: Auth cancel Pull: Still asking for URL and keys. When I click cancel I get: Cannot connect to the remote repository at git@redmine.domain.cz:repodir/repo_1.git Could anyone help with this problem? > Private key: D:\Dokumenty\Keys\user.ppk this is suspicious: are you sure the key is in the OpenSSH format? Please note that our internals can work only with OpenSSH format: it's mentioned in the guide: https://netbeans.org/kb/docs/ide/git.html#github (In reply to comment #31) > > Private key: D:\Dokumenty\Keys\user.ppk > this is suspicious: are you sure the key is in the OpenSSH format? Please note > that our internals can work only with OpenSSH format: it's mentioned in the > guide: https://netbeans.org/kb/docs/ide/git.html#github I generated my keys in the Puttygen, but they are causing another error: git@redmine.domain.cz:repodir/repo_1.git: invalid privatekey: D:\Dokumenty\Keys\admin-putty.ppk So I converted it manually into OpenSSH format and there I made the mistake. I converted it badly. Now I tried to open the private key in the PuttyGen and export it as OpenSSH key using it and everything works fine. Thank you for your help. Also note that in 7.4 the git support should be able to communicate with ssh-agent and paegeant directly and there should be no need to export to openssh format. So if you correctly setup paegeant on windows and import the key to the tool the git support should connect automatically without need to specify the key file or passphrase. See bug #218918 for more info |