Tinaira
Tinaira

Reputation: 857

Make vsCode not ask for gitlab ssh passphrase on push

I created the ssh key, added it on gitlab, and followed the instructions. When I do a push from git bash everything works fine, it keeps annoying me to enter the passphrase every time. But when I try to push from vsCode it doesn't ask me for the passphrase and throws an error

Git: [email protected]: Permission denied (publickey,keyboard-interactive).

Is there any way to fix this? And bonus help: how can I stop it from asking me every time for the passphrase.

I know, there are similar questions around for my bonus help, but I couldn't find anything about the vsCode issue. I am using windows 11.

Sorry if the title is misleading.

Upvotes: 8

Views: 8461

Answers (4)

Omar Khalil
Omar Khalil

Reputation: 21

I assume you already properly configured your terminal to save key using ssh-agent. if that was the case you need to make sure that there is no other ssh.exe presented especially under C:\Program Files\Git\usr\bin in my case vscode preferred the ssh.exe in that path and this broke since I don't have ssh-agent there. my solution was just to delete it since the C:\Windows\System32\OpenSSH\ssh.exe is serving as the ssh command

Upvotes: 2

Yevhenii
Yevhenii

Reputation: 337

You can save passphrase in the Keychain store.

For mac

ssh-add --apple-use-keychain ~/.ssh/[private-key]

older than 12.0 Monterey

ssh-add -K ~/.ssh/[your-private-key]

Here is similar question .

Upvotes: 4

VonC
VonC

Reputation: 1323333

But when I try to push from vsCode it doesn't ask me for the passphrase and throws an error

It will ask you, starting with VSCode 1.72 (Sept. 2022):

When an SSH key with a passphrase is used for Git operations, VS Code will now display the quick input control so that you can enter the passphrase for the SSH key.

The passphrase is not cached and has to be entered every time a Git operation is performed.

Using an ssh-agent should help avoiding the passphrase (more than once per session). See "VScode on OSX - GIT ssh key passphrase - working from build in terminal put not from command palette".

Upvotes: 3

Jaymit Gupta
Jaymit Gupta

Reputation: 895


I think you have given passphrase while creating the keys that is why, you need to supply passphrase everytime you commit something. One solution is that update/ re make the ssh keys without passphase and add it to gitlab.

Upvotes: 0

Related Questions