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.

Bug 231306 - Authentication with ssh key does not work any more
Summary: Authentication with ssh key does not work any more
Status: RESOLVED WORKSFORME
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-15 15:53 UTC by everflux
Modified: 2013-06-21 12:58 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description everflux 2013-06-15 15:53:51 UTC
Product Version: NetBeans IDE Dev (Build 201306142301)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01

Since this build I can not push git changes, the authentication dialog appears always and even when entering the right password, the push does not work, but brings the password dialog up again.

System: Ubuntu 13.04 / Gnome 3
Comment 1 everflux 2013-06-15 19:16:08 UTC
From the log file:

WARNING [org.netbeans.modules.progress.spi.InternalHandle]: Cannot call progress on a task that wa
s never started at org.netbeans.modules.git.client.GitProgressSupport.setProgressMessage(GitProgre
ssSupport.java:229)


after the credentials dialog appears again I click cancel and this appears

INFO [org.netbeans.modules.git]: git@...: Auth cancel
com.jcraft.jsch.JSchException: Auth cancel
        at com.jcraft.jsch.Session.connect(Session.java:490)
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
Caused: org.eclipse.jgit.errors.TransportException: git@g.....: Auth cancel
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:142)
        at org.netbeans.libs.git.jgit.JGitSshSessionFactory.getSession(JGitSshSessionFactory.java:114)
        at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
        at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:306)
        at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:152)
        at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:130)
        at org.eclipse.jgit.transport.Transport.push(Transport.java:1162)
        at org.netbeans.libs.git.jgit.commands.PushCommand.runTransportCommand(PushCommand.java:111)
Caused: org.netbeans.libs.git.GitException$AuthorizationException: git@git......: Auth cancel
        at org.netbeans.libs.git.jgit.commands.TransportCommand.handleException(TransportCommand.java:196)
        at org.netbeans.libs.git.jgit.commands.PushCommand.runTransportCommand(PushCommand.java:141)
        at org.netbeans.libs.git.jgit.commands.TransportCommand.run(TransportCommand.java:140)
        at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:72)
        at org.netbeans.libs.git.GitClient.push(GitClient.java:857)
        at org.netbeans.modules.git.client.GitClient$38.call(GitClient.java:602)
        at org.netbeans.modules.git.client.GitClient$38.call(GitClient.java:598)
        at org.openide.util.NetworkSettings.suppressAuthenticationDialog(NetworkSettings.java:140)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:804)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:810)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker$1.call(GitClient.java:825)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethodIntern(GitClient.java:837)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:766)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:748)
        at org.netbeans.modules.git.client.GitClient$CommandInvoker.access$400(GitClient.java:742)
        at org.netbeans.modules.git.client.GitClient.push(GitClient.java:598)
[catch] at org.netbeans.modules.git.ui.push.PushAction$2.perform(PushAction.java:173)
        at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:102)
        at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:95)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
Comment 2 Ondrej Vrabec 2013-06-17 09:09:24 UTC
cannot reproduce with:
Product Version: NetBeans IDE Dev (Build 20130617-ab3512bc7eab)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b14
System: Linux version 3.1.10-1.19-desktop running on amd64; UTF-8; en_US (nb)

1) Git -> Remote -> Push...
2) Enter a repository URL for an SSH connection (bugtracking-test.cz.oracle.com:/srv/git/repo)
3) Setting username to the correct username
4) selecting username/password authentication option and setting password to the correct password and selecting "Save Password" option
5) click on Next, works OK

Are you sure you didn't forget to explicitly set the username field? Does it work in commandline? Attach the full IDE log.
Comment 3 everflux 2013-06-17 09:53:44 UTC
It worked flawlessly until a recent nightly build when suddenly the dialog appeared. (I had saved ssh key and ssh passphrase, the values are prefilled by netbeans. I assume correctly, though I didn't count the stars of the passphrase.)

Are there any logging/debug levels that I can try to set to narrow that down?
Comment 4 Ondrej Vrabec 2013-06-17 10:14:00 UTC
> I had saved ssh key and ssh passphrase
So you're not using username/password authentication as you mentioned in the bug description:
> and even when entering the right password

Is the path to the key file correct? There may be a problem with our password/passphrase storage, please:
1) run the IDE with -J-Dversioning.util.KeyringSupport.level=-1 and -J-Dversioning.keyring.logpassword=true" (careful with these options, do not attach the ide.log directly, they will log your credentials in plaintext)
2) try to push.
3) Then open the messages log, check the passwords and passphrases mentioned in the log are correct, replace the passwords and all sensitive data with '*' and attach the log here (or e-mail it to me directly)
Comment 5 everflux 2013-06-17 17:43:44 UTC
Here is the debugging output. The auth cancel at the end happens only after I abort the dialog after it re-appeared.


INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 21 source roots took: 1,798 ms (New or modified files: 5, Deleted files: 0) [Adding listeners took: 14 ms]
INFO [org.netbeans.modules.maven.jaxws.MavenJaxWsSupportProvider]: Inside update JAX-WS , WS root :org.netbeans.modules.j2ee.dd.impl.webservices.annotation.WebservicesImpl@430cd4b8 ; number of descriptions :0
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:/fabtane/businesss -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:ssh://bitbucket.org/everflux/bp-forum.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:bitbucket.org:everflux/bp-integration.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@bitbucket.org:defsprite/wecodetogether-api.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.rfoo.net:users/srt/bp-analyzer -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:foobar/pricetool -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:rfoo/afoo -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:foobar/md -- PASSWORD
FINE [versioning.util.KeyringSupport]: No password for guri_passphrase:git@git.rfoo.net:foobar/md.git
FINE [versioning.util.KeyringSupport]: No password for guri_password:file:///home/tkruse/arbeit/rfoo/foobar/git/md/
FINE [versioning.util.KeyringSupport]: Saving password for guri_password:git@git.myhost:/fabtane/businesss
FINEST [versioning.util.KeyringSupport]: Saving password: ""
FINE [versioning.util.KeyringSupport]: Saving password for guri_passphrase:git@git.myhost:/fabtane/businesss
FINEST [versioning.util.KeyringSupport]: Saving password: PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:/fabtane/businesss -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:ssh://bitbucket.org/everflux/bp-forum.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:bitbucket.org:everflux/bp-integration.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@bitbucket.org:defsprite/wecodetogether-api.git -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.rfoo.net:users/srt/bp-analyzer -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:foobar/pricetool -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:rfoo/afoo -- PASSWORD
FINEST [versioning.util.KeyringSupport]: Getting password: guri_passphrase:git@git.myhost:foobar/md -- PASSWORD
FINE [versioning.util.KeyringSupport]: No password for guri_passphrase:git@git.rfoo.net:foobar/md.git
FINE [versioning.util.KeyringSupport]: No password for guri_password:file:///home/tkruse/arbeit/rfoo/foobar/git/md/
INFO [org.netbeans.modules.git]: git@git.myhost:/fabtane/business: Auth cancel
com.jcraft.jsch.JSchException: Auth cancel
	at com.jcraft.jsch.Session.connect(Session.java:490)
	at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
Caused: org.eclipse.jgit.errors.TransportException: git@git.myhost:/fabtane/business: Auth cancel
	at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:142)
	at org.netbeans.libs.git.jgit.JGitSshSessionFactory.getSession(JGitSshSessionFactory.java:114)
	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.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1104)
	at org.netbeans.libs.git.jgit.commands.FetchCommand.runTransportCommand(FetchCommand.java:103)
Caused: org.netbeans.libs.git.GitException$AuthorizationException: git@git.myhost:/fabtane/business: Auth cancel
	at org.netbeans.libs.git.jgit.commands.TransportCommand.handleException(TransportCommand.java:196)
	at org.netbeans.libs.git.jgit.commands.FetchCommand.runTransportCommand(FetchCommand.java:126)
	at org.netbeans.libs.git.jgit.commands.TransportCommand.run(TransportCommand.java:140)
	at org.netbeans.libs.git.jgit.commands.GitCommand.execute(GitCommand.java:72)
	at org.netbeans.libs.git.GitClient.fetch(GitClient.java:538)
	at org.netbeans.modules.git.client.GitClient$17.call(GitClient.java:386)
	at org.netbeans.modules.git.client.GitClient$17.call(GitClient.java:382)
	at org.openide.util.NetworkSettings.suppressAuthenticationDialog(NetworkSettings.java:140)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:804)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker$1$1.call(GitClient.java:810)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker$1.call(GitClient.java:825)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethodIntern(GitClient.java:837)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:766)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.runMethod(GitClient.java:748)
	at org.netbeans.modules.git.client.GitClient$CommandInvoker.access$400(GitClient.java:742)
	at org.netbeans.modules.git.client.GitClient.fetch(GitClient.java:382)
	at org.netbeans.modules.git.ui.fetch.PullAction$GitProgressSupportImpl$1.call(PullAction.java:185)
	at org.netbeans.modules.git.ui.fetch.PullAction$GitProgressSupportImpl$1.call(PullAction.java:177)
	at org.netbeans.modules.versioning.indexingbridge.Bridge$1.call(Bridge.java:64)
	at org.netbeans.modules.parsing.api.indexing.IndexingManager.runProtected(IndexingManager.java:396)
	at org.netbeans.modules.versioning.indexingbridge.Bridge.runWithoutIndexing(Bridge.java:59)
	at org.netbeans.modules.versioning.util.IndexingBridge.runWithoutIndexing(IndexingBridge.java:139)
	at org.netbeans.modules.versioning.util.IndexingBridge.runWithoutIndexing(IndexingBridge.java:102)
	at org.netbeans.modules.git.utils.GitUtils.runWithoutIndexing(GitUtils.java:854)
[catch] at org.netbeans.modules.git.ui.fetch.PullAction$GitProgressSupportImpl.perform(PullAction.java:177)
	at org.netbeans.modules.git.client.GitProgressSupport.performIntern(GitProgressSupport.java:102)
	at org.netbeans.modules.git.client.GitProgressSupport.run(GitProgressSupport.java:95)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 2 ms
Comment 6 everflux 2013-06-17 17:52:30 UTC
The passphrase is correct and the username, selected ssh key etc. is correct as well.

I used "seahorse" to delete the passphrase for the git repo, then restarted netbeans.

Netbeans selects the correct key and username, I enter the correct passphrase.

What is really strange: Netbeans seems to save the credentials *twice*

FINE [versioning.util.KeyringSupport]: Saving password for guri_password:git@repo/businesss
FINE [versioning.util.KeyringSupport]: Saving password for guri_passphrase:git@repo/businesss

Once as password, once as passphrase.

Checking with "searhorse" I find two entries indeed. One with the correct passphrase, the other one with an empty password. I believe one is for the ssh key, the other one for username/password authentication and therefore should indeed be empty.
Comment 7 Ondrej Vrabec 2013-06-18 12:15:17 UTC
I still cannot reproduce, not sure where the problem could be. The only thing we have changed in the last few weeks was introducing the ability to work with ssh-agent, maybe that could be somehow related.
1) does your linux distro run ssh-agent (ps -ef | grep ssh-agent)? Does it handle any private keys?
2) can you fetch with commandline client?
3) can you make a screenshot of the repository connection settings?
Comment 8 Ondrej Vrabec 2013-06-18 12:44:18 UTC
i added at least some logging: core-main #f43707c68015
so please when the commit gets integrated into a dev build, try to run the IDE with -J-Dorg.netbeans.libs.git.jgit.JGitSshSessionFactory.level=FINE, try a fetch and attach the messages.log when it fails.
Comment 9 everflux 2013-06-18 17:00:09 UTC
Product Version: NetBeans IDE Dev (Build 201306152301)

1) yes
/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=gnome

2) yes, without question for passphrase
3) ....

Ok I found the issue, it was a local problem. But perhaps it can be used to improve Netbeans anyway.

I had a repository that was mis-spelled. I changed it on the origin, edited the .git/config file. (That worked with the CLI, but of course not Netbeans. At the time I encountered the problem in Netbeans I forgot about the renaming.)

In order to produce the screenshot for your question 3 I searched for the repo browser and clicked on "fetch..." which did not work with the "configured git repository location" (as expected), though I did not notice the spelling problem.
But this time the log file was different:

INFO [org.netbeans.modules.git.ui.repository.remote.SelectUriStep]: Cannot connect to REPO
com.jcraft.jsch.JSchException: Auth cancel
        at com.jcraft.jsch.Session.connect(Session.java:490)
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
Caused: org.eclipse.jgit.errors.TransportException:
.....
INFO [org.netbeans.modules.git.ui.repository.remote.SelectUriStep]: Cannot connect to MISSPELLED_REPO
org.eclipse.jgit.errors.NoRemoteRepositoryException: MISSPELLED_REPO: FATAL: R any MISSPELLED_PATH tkruse DENIED by fallthru
(or you mis-spelled the reponame)

        at org.eclipse.jgit.transport.TransportGitSsh.cleanNotFound(TransportGitSsh.java:194)
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:274)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)

I wonder why this messages was not produced in the past. Assumption: Selecting "Pull from Upstream" behaves differently then "Pull...." and selecting a repository.
In order to improve the user experience even for stupid users like me it would be good to have that message shown in the output window or somewhere in the error dialog instead insisting on wrong credentials.

Amazingly the repository browser showed the repo correctly, fetching there worked and after that even clicking on the project "Pull from upstream" worked flawlessly. I assume the config was re-read at some point, since I did not make any changes manually.

On the next start of Netbeans I had to configure the ssh key and passphrase again, that information was lost. (ssh-agent was not used neither)
On the third restart everything worked as expected, though.

In summary:
- The bug was not in Netbeans but me
- Logging of error conditions could help saving your precious time (and that of users having problems)
- Logging should be consistent even when using "Pull from upstream" vs. selecting a repo uri manually and clicking "next" in the wizard
- Re-reading (possibly manual or automatic as part of release processes) configuration changes either never or always would lead to more consistent behaviour.
Comment 10 Ondrej Vrabec 2013-06-21 12:58:29 UTC
> - Logging of error conditions could help saving your precious time (and that of users having problems)
> - Logging should be consistent even when using "Pull from upstream" vs. selecting a repo uri manually and clicking "next" in the wizard
It is consistent and it works for me.
1) edit .gitconfig and change the repository name, in my case from bugtracking-test.cz.oracle.com:/srv/git/repo to bugtracking-test.cz.oracle.com:/srv/git/repozzz
2) Git -> Fetch from Upstream
3) i get the authentication dialog asking me to provide correct credentials (which is correct because for this URI NetBeans does not yet have credentials)
4) clicking on OK, fetch continues and then fails with a clear error: bugtracking-test.cz.oracle.com:/srv/git/repozzz: unable to chdir or not a git archive
> org.eclipse.jgit.errors.NoRemoteRepositoryException: gittester@bugtracking-test.cz.oracle.com:/srv/git/repozzz: unable to chdir or not a git archive
>        at org.eclipse.jgit.transport.TransportGitSsh.cleanNotFound(TransportGitSsh.java:194)
>        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:274)