Skip to content

Every time I push to Github, I need to type passphrase for ssh key

Daisho Komiyama edited this page Dec 9, 2021 · 1 revision

I've set ssh-add as this post addresses I'm still required to enter a passphrase even after setting ssh key. This works when I use Terminal (iTerm2), but from VS Code built-in terminal it doesn't work. I have to type the passphrase every time I push to Github.

I found an article from VS Code docs. This might be the reason. The easiest workaround for me is launching VS Code from my terminal via code .

Resolving shell environment fails#

This section applies to macOS and Linux environments only. When VS Code is launched from a terminal (for example, via code .), it has access to environment settings defined in your .bashrc or .zshrc files. This means features like tasks or debug targets also have access to those settings. However, when launching from your platform's user interface (for example, the VS Code icon in the macOS dock), you normally are not running in the context of a shell and you don't have access to those environment settings. This means that depending on how you launch VS Code, you may not have the same environment.

To work around this, when launched via a UI gesture, VS Code will start a small process to run (or "resolve") the shell environment defined in your .bashrc or .zshrc files. If, after 10 seconds, the shell environment has still not been resolved or resolving failed for any other reason, VS Code will abort the "resolve" process, launch without your shell's environment settings, and you will see an error like the following:

Clone this wiki locally