简体   繁体   中英

Why does the VS Code terminal always ask for my SSH passphrase?

I'm using Ubuntu 20.10 and VS Code 1.52.1. I followed GitHub's instructions to generate an SSH key, add it to the ssh-agent , and add it to my GitHub account . When I use Ubuntu's built-in Terminal app, everything works correctly for repos that I clone with SSH:

git clone git@github.com:octocat/Spoon-Knife.git
cd Spoon-Knife
git fetch

It doesn't ask for my passphrase every time. Similarly, if I open that cloned repo (or any other) in VS Code and run the Git: Fetch command (or Git: Push etc), it runs successfully without asking for my passphrase.

But when I run git fetch from the same directory inside of the VS Code integrated terminal, I get this message:

Enter passphrase for key '/home/sam/.ssh/id_ed25519':

Even if I enter my passphrase for this invocation, it still keeps asking for my passphrase every time I run git fetch . How can I fix this and make it act like the Ubuntu default terminal? (I saw this question , but it seems to be for the VS Code UI rather than the integrated terminal, and none of the answers worked; most of them were steps that I had already followed as per the GitHub instructions linked above.)

Check in your VS Code settings to see if you have Terminal › Integrated: Inherit Env unchecked:

将 inheritEnv 设置为 false 的设置 UI

If it is, re-check it:

将 inheritEnv 设置为 true 的设置 UI

Alternatively, use the Preferences: Open Settings (JSON) command to open your settings file and look for this line:

"terminal.integrated.inheritEnv": false

If it's present, remove it (since true is the default for that setting).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM