skyfreak42
skyfreak42

Reputation: 55

VScode on OSX - GIT ssh key passphrase - working from build in terminal put not from command palette

I can connect to the Git server and do anything I want from the VSCode build in terminal, but, as soon as I use the command pallette and want to perform a push, it fails as now passphrase prompt is shown.

Is there any way to avoid entering the passphrase at each push?

Upvotes: 1

Views: 7145

Answers (3)

Bjørnar Hvidsten
Bjørnar Hvidsten

Reputation: 969

Automatically load keys into the ssh-agent and store passphrases in the keychain: (see step 2)

If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.

First, check to see if your ~/.ssh/config file exists in the default location.

$ open ~/.ssh/config
> The file /Users/YOU/.ssh/config does not exist.

If the file doesn't exist, create the file.

$ touch ~/.ssh/config

Open your ~/.ssh/config file, then modify the file to contain the following lines. If your SSH key file has a different name or path than the example code, modify the filename or path to match your current setup.

Host *.github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

Upvotes: 2

skyfreak42
skyfreak42

Reputation: 55

to make it work I had to ad the key to OSX keychain and configure it in .ssh/config

Upvotes: -1

VonC
VonC

Reputation: 1323953

That seems expected considering the Remote Development Tips and Tricks section:

Enabling alternate SSH authentication methods#

If you are connecting to an SSH remote host and are either:

  • Connecting with two-factor authentication
  • Using password authentication
  • Using an SSH key with a passphrase when the SSH Agent is not running or accessible

then VS Code should automatically prompt you to enter needed information. I

So make sure the SSH agent is running locally

VS Code will automatically add your key to the agent so you don't have to enter your passphrase every time you open a remote VS Code window.

To verify that the agent is running and is reachable from VS Code's environment, run ssh-add -l in the terminal of a local VS Code window.
You should see a listing of the keys in the agent (or a message that it has no keys).
If the agent is not running, follow these instructions to start it. After starting the agent, be sure to restart VS Code.

Upvotes: 3

Related Questions