You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by lkishalmi <gi...@git.apache.org> on 2017/09/29 22:08:53 UTC
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
GitHub user lkishalmi opened a pull request:
https://github.com/apache/incubator-netbeans/pull/25
NETBEANS-73: Autodetect id_rsa and id_dsa keys for Git private key.
Simple patch for https://issues.apache.org/jira/browse/NETBEANS-73
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/lkishalmi/incubator-netbeans NETBEANS-73_Git_Private_Key_Improvement
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-netbeans/pull/25.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #25
----
commit 5c1ea668924c481e0d24c82c9fbcd5158e055780
Author: Laszlo Kishalmi <la...@epam.com>
Date: 2017-09-29T22:03:39Z
NETBEANS-73: Autodetect id_rsa and id_dsa keys for Git private key.
----
---
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
Posted by lkishalmi <gi...@git.apache.org>.
Github user lkishalmi commented on a diff in the pull request:
https://github.com/apache/incubator-netbeans/pull/25#discussion_r142020017
--- Diff: git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -686,6 +686,7 @@ public SSHConnectionSettingsType () {
settingsPanel.savePasswordCheckBox
};
acceptableSchemes = EnumSet.of(Scheme.SSH, Scheme.SFTP);
+ settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
--- End diff --
Unfortunately populateFields is not called in every case. Most importantly when the repository URL is being copied from github/gitlab where the ssh:// prefix is just missing from the URL. Probably I could raise a bug on that. And mark this line as a workaround in the code, till it gets fixed. I feel the fix would be a bit out of the trivial category.
---
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
Posted by emilianbold <gi...@git.apache.org>.
Github user emilianbold commented on a diff in the pull request:
https://github.com/apache/incubator-netbeans/pull/25#discussion_r141999246
--- Diff: git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -686,6 +686,7 @@ public SSHConnectionSettingsType () {
settingsPanel.savePasswordCheckBox
};
acceptableSchemes = EnumSet.of(Scheme.SSH, Scheme.SFTP);
+ settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
--- End diff --
This line does not seem necessary. `SSHConnectionSettingsType.populateFields` does call
```java
String identityFile = getDefaultIdentityFilePath();
settingsPanel.txtIdentityFile.setText(identityFile);
```
---
[GitHub] incubator-netbeans issue #25: NETBEANS-73: Autodetect id_rsa and id_dsa keys...
Posted by emilianbold <gi...@git.apache.org>.
Github user emilianbold commented on the issue:
https://github.com/apache/incubator-netbeans/pull/25
Committed: https://github.com/apache/incubator-netbeans/commit/ff5f3c4e175cf15c1b4b0caebfb5047be4196a44
---
[GitHub] incubator-netbeans issue #25: NETBEANS-73: Autodetect id_rsa and id_dsa keys...
Posted by lkishalmi <gi...@git.apache.org>.
Github user lkishalmi commented on the issue:
https://github.com/apache/incubator-netbeans/pull/25
I've made a small change to do the detection only when the key auth is selected.
---
[GitHub] incubator-netbeans issue #25: NETBEANS-73: Autodetect id_rsa and id_dsa keys...
Posted by emilianbold <gi...@git.apache.org>.
Github user emilianbold commented on the issue:
https://github.com/apache/incubator-netbeans/pull/25
Please close this PR.
---
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
Posted by lkishalmi <gi...@git.apache.org>.
Github user lkishalmi closed the pull request at:
https://github.com/apache/incubator-netbeans/pull/25
---
[GitHub] incubator-netbeans issue #25: NETBEANS-73: Autodetect id_rsa and id_dsa keys...
Posted by lkishalmi <gi...@git.apache.org>.
Github user lkishalmi commented on the issue:
https://github.com/apache/incubator-netbeans/pull/25
Thank you!
---
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
Posted by emilianbold <gi...@git.apache.org>.
Github user emilianbold commented on a diff in the pull request:
https://github.com/apache/incubator-netbeans/pull/25#discussion_r142020102
--- Diff: git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -686,6 +686,7 @@ public SSHConnectionSettingsType () {
settingsPanel.savePasswordCheckBox
};
acceptableSchemes = EnumSet.of(Scheme.SSH, Scheme.SFTP);
+ settingsPanel.txtIdentityFile.setText(getDefaultIdentityFilePath());
--- End diff --
But what if I'm not using an identity file?
---
[GitHub] incubator-netbeans pull request #25: NETBEANS-73: Autodetect id_rsa and id_d...
Posted by emilianbold <gi...@git.apache.org>.
Github user emilianbold commented on a diff in the pull request:
https://github.com/apache/incubator-netbeans/pull/25#discussion_r141999265
--- Diff: git/src/org/netbeans/modules/git/ui/repository/remote/RemoteRepository.java ---
@@ -853,9 +854,13 @@ protected int getPreferedPanelHeight () {
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();
--- End diff --
This looks OK.
---