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 218918 - Cannot push from NetBeans using ssh-agent
Summary: Cannot push from NetBeans using ssh-agent
Status: VERIFIED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on: 206698
Blocks:
  Show dependency tree
 
Reported: 2012-09-24 15:33 UTC by Jesse Glick
Modified: 2013-05-15 20:42 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-09-24 15:33:51 UTC
Dev builds, but true as long as I can remember. I am unable to use NetBeans to perform any Git operations requiring SSH authentication: pushing to GitHub, pulling from a private repository, etc. The same operations using command-line Git work fine, but in NetBeans I am prompted for a username and password, or for a private key with passphrase. This is unnecessary from the command line as I use ssh-agent to unlock my private key without needing to type in the passphrase every time; apparently the Git library used by NB does not manage to communicate with ssh-agent so it fails.

Note that ssh-agent is run by default on a modern Linux distribution, and probably on Macs as well. I do not wish to have SSH credentials stored in any other way.

https://sourceforge.net/tracker/index.php?func=detail&aid=3555106&group_id=273755&atid=1163478 may be relevant.

If it is not feasible to fix the in-JVM library to work properly with ssh-agent, at least offer the option to use command-line Git for remote operations so I do not need to use a shell just to ‘git pull’ or ‘git push’.
Comment 1 Ondrej Vrabec 2012-09-24 15:56:02 UTC
Git uses JGit (a pure Java implementation of Git client) which does not use either commandline client or an external ssh process to run remote commands. It uses jsch as ssh implementation. Do you have any idea if JSch can be somehow made to cooperate with ssh-agent?
BTW, what's the problem with keeping your passwords in keyring? You are its original author so i would assume you'd believe in its reliability.
> at least offer the option to use command-line Git for remote operations
Sorry, i have no intention of letting the commandline client into the game, the whole point of using JGit was to avoid parsing commandline output, running external processes and forcing user to setup the ssh-agent when you can simply enter all needed data inside the IDE only.
Comment 2 Ondrej Vrabec 2012-09-24 16:04:08 UTC
this might be the way: bug #206698
Comment 3 Jesse Glick 2012-09-24 17:05:44 UTC
jsch-agent-proxy sounds like the right solution; I did not find this before. Marking as a dependency on bug #206698 since that is categorized under CVS, though the same fix would probably apply to both.
Comment 4 Jesse Glick 2012-11-08 20:16:27 UTC
(In reply to comment #1)
> forcing user to setup the ssh-agent

Modern Linux distributions, and IIRC Macs as well, set it up out of the box.

I found that you can use the private keyring option as a workaround. But it is awkward: for every repository you connect to, you need to browse to ~/.ssh/id_[dr]sa (why is this not the default?), and reënter your passphrase.
Comment 5 Ondrej Vrabec 2013-01-18 13:12:47 UTC
at least some evaluation needed in 7.3next
Comment 6 Ondrej Vrabec 2013-05-02 12:01:19 UTC
fix: http://hg.netbeans.org/core-main/rev/e54e83490ba9
Comment 7 Ondrej Vrabec 2013-05-02 12:06:29 UTC
Should be relatively transparent for the user. When selecting identity file/passphrase authentication the git library should first ask sshagent and only when that fails use the actual identity files/passphrase authentication.
Comment 8 Quality Engineering 2013-05-04 01:47:40 UTC
Integrated into 'main-golden', will be available in build *201305032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/e54e83490ba9
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #218918 - Cannot push from NetBeans using ssh-agent
support for ssh-agent and pageant
Comment 9 Jesse Glick 2013-05-15 13:37:41 UTC
It works, thanks.

A UI comment, though: rather than popping open a dialog defaulting to password authentication and making the user (a) click the radio button for private key authentication, (b) clicking the Browse button and selecting ~/.ssh/id_[rd]sa, why not just try authenticating with ssh-agent right away and only bother the user if this does not work?
Comment 10 Jesse Glick 2013-05-15 20:42:48 UTC
Seems that the automatic use of ssh-agent is now working; maybe was only broken for repositories which I had tried to push/pull from in NetBeans prior to this fix.