sveale / remote-edit

remote-edit
MIT License
146 stars 54 forks source link

Steps for resolving Uncaught Error: Encrypted private key detected, but no passphrase given #217

Open skilfullycurled opened 7 years ago

skilfullycurled commented 7 years ago

Hi,

First, thank you for this package! It's been essential to my workflow.

TL;DR: I'm not sure if this is a bug with the package or (more likely) the settings in my computer (OSX 10.11.5) but I hope it's okay to pass it along in case others come across it. In order to make node-keytar work, I had to manually add my passphrase with ssh-add -K and edit the ~/.atom/remoteEdit.json file and set "useAgent" to true. There are some other things that happened in between which may or may not have contributed, so I've detailed the journey below.

Again, many thanks!




DETAILS

I decided to implement the node-keytar functionality and after doing so, I received the following error (stack trace below):

Uncaught Error: Encrypted private key detected, but no passphrase given

Naturally, I first tried the suggestions listed in the tips and tricks section of the remote-edit readme.md. When that didn't resolve the issue, I did a bit more research and decided to start with the idea that my passphrase wasn't in my keychain. In order to add it I used the suggestions here and here, specifically:

ssh-add -K

This did add the passphrase to my keychain (it appeared in the GUI app) but the issue persisted. Then it occurred to me (based off more research) that perhaps I needed to restart the ssh agent since I had made changes from the tips and tricks. I found out how to do that here, in particular:

sudo launchctl stop com.openssh.sshd

This did not work either. Somehow I got the idea that I should take a look at the ~/.atom/remoteEdit.json file where I saw that the "useAgent" setting was set to false. I changed it to true, after which everything worked as expected.

Settings

Atom: 1.14.3 x64 Electron: 1.3.13 OS: Mac OS X 10.11.5 Thrown From: remote-edit package 1.9.0

Stack Trace

Uncaught Error: Encrypted private key detected, but no passphrase given

At /Users/<username>/.atom/packages/remote-edit/node_modules/ssh2/lib/client.js:151

Error: Encrypted private key detected, but no passphrase given
    at Client.connect (/packages/remote-edit/node_modules/ssh2/lib/client.js:151:15)
    at /packages/remote-edit/lib/model/sftp-host.coffee:124:23
    at fn (/app.asar/node_modules/async/lib/async.js:573:34)
    at /app.asar/node_modules/async/lib/async.js:489:34
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Commands

     -5:23.8.0 core:copy (div.package-readme.native-key-bindings)

Non-Core Packages

atom-beautify 0.29.13 
file-type-icons 1.3.3 
highlight-selected 0.11.2 
linter 1.11.18 
linter-jshint 3.0.1 
minimap 4.25.7 
minimap-find-and-replace 4.5.1 
minimap-highlight-selected 4.4.0 
pretty-json 1.6.1 
remote-edit 1.9.0 
terminal-plus 0.14.5