You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by em...@apache.org on 2017/10/03 12:20:38 UTC
[4/5] incubator-netbeans git commit: Made Git keyfile auto detection
when key auth is selected.
Made Git keyfile auto detection when key auth is selected.
Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/commit/ff5f3c4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/tree/ff5f3c4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/diff/ff5f3c4e
Branch: refs/heads/master
Commit: ff5f3c4e175cf15c1b4b0caebfb5047be4196a44
Parents: 7d5633a
Author: Laszlo Kishalmi <la...@gmail.com>
Authored: Fri Sep 29 15:03:39 2017 -0700
Committer: Emilian Bold <em...@apache.org>
Committed: Tue Oct 3 15:10:29 2017 +0300
----------------------------------------------------------------------
.../git/ui/repository/remote/RemoteRepository.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ff5f3c4e/git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java
----------------------------------------------------------------------
diff --git a/git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java b/git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java
index 252040c..b353f29 100644
--- a/git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java
+++ b/git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java
@@ -844,6 +844,9 @@ public class RemoteRepository implements DocumentListener, ActionListener, ItemL
for (JComponent c : authPasswordFields) {
c.setEnabled(authViaPassword);
}
+ if (authViaPrivateKey && settingsPanel.txtIdentityFile.getText().trim().isEmpty()) {
+ settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
+ }
}
@Override
@@ -853,9 +856,13 @@ public class RemoteRepository implements DocumentListener, ActionListener, ItemL
private String getDefaultIdentityFilePath () {
String identityFile = ""; //NOI18N
- if (!Utilities.isWindows()) {
- identityFile = System.getProperty("user.home") + File.separator //NOI18N
- + ".ssh" + File.separator + "id_dsa"; //NOI18N
+ File sshDir = new File(System.getProperty("user.home"), ".ssh"); //NOI18N
+ File rsaKey = new File(sshDir, "id_rsa"); //NOI18N
+ File dsaKey = new File(sshDir, "id_dsa"); //NOI18N
+ if (rsaKey.canRead()) {
+ identityFile = rsaKey.getAbsolutePath();
+ } else if (dsaKey.canRead()) {
+ identityFile = dsaKey.getAbsolutePath();
}
return identityFile;
}