microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.49k stars 28.65k forks source link

Asks for a ssh passphrase even if OS has keychain started #162924

Closed alexamy closed 1 year ago

alexamy commented 1 year ago

Type: Bug

  1. Start keychain system-wide with your ssh key (will ask for passphrase on system start)
  2. Open git repository that has ssh remote
  3. Try to push some commits to remote repository

Expected

VSCode will not ask for a ssh passphrase, push will succeed. This is a behavior prior to 1.72 version on my system.

Actual

VSCode will ask for a ssh passphrase, push will fail. Even if I enter proper passphrase, it will fail. But this is a different issue, I just want to turn off passphrase check.

VS Code version: Code 1.72.0 (64bbfbf67ada9953918d72e1df2f4d8e537d340e, 2022-10-04T23:20:47.539Z) OS version: Linux x64 5.19.13-arch1-1 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 3600 6-Core Processor (12 x 3235)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|15.55GB (5.49GB free)| |Process Argv|--unity-launch --crash-reporter-id 9f0c2b97-4bab-4e32-833c-349253cfe6a1| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|plasma| |XDG_CURRENT_DESKTOP|KDE| |XDG_SESSION_DESKTOP|KDE| |XDG_SESSION_TYPE|x11|
Extensions (58) Extension|Author (truncated)|Version ---|---|--- Bookmarks|ale|13.3.1 project-manager|ale|12.7.0 emojisense|bie|0.9.1 folder-source-actions|bie|0.2.1 lit-html|bie|1.11.1 vscode-tailwindcss|bra|0.8.7 rescript-vscode|che|1.8.1 path-intellisense|chr|2.8.1 rainbow-highlighter|cob|0.1.0 vscode-svgviewer|css|2.0.0 postcss|css|1.0.9 mustache|daw|1.1.1 vscode-eslint|dba|2.2.6 javascript-ejs-support|Dig|1.3.1 gitlens|eam|12.2.2 vscode-html-css|ecm|1.13.1 replacequotes|eda|0.0.1 EditorConfig|Edi|0.16.4 elm-ls-vscode|elm|2.5.1 prettier-vscode|esb|9.9.0 vscode-commands|fab|1.4.3 vscode-jest-runner|fir|0.4.57 vscode-pull-request-github|Git|0.50.0 graph-syntax-vscode|Ale|0.0.1 todo-tree|Gru|0.0.215 haskell|has|2.2.1 vscode-test-explorer|hbe|2.21.1 output-colorizer|IBM|0.1.2 handydandy-notebook|jak|0.1.4 super-replace|jeb|0.3.1 snipped|jef|1.3.0 language-haskell|jus|3.6.0 endwise|kai|1.5.1 monokai-pro-new-kc|kvn|0.0.4 rainbow-csv|mec|3.2.0 theme-monokai-pro-vscode|mon|1.1.21 vscode-docker|ms-|1.22.1 playwright|ms-|0.2.10 python|ms-|2022.16.0 vscode-pylance|ms-|2022.10.10 jupyter|ms-|2022.9.1002791758 vscode-jupyter-cell-tags|ms-|0.1.6 vscode-jupyter-slideshow|ms-|0.1.5 test-adapter-converter|ms-|0.1.6 coffeesense|phi|1.13.0 pixelbyte-love2d|pix|0.1.22 prisma|Pri|4.4.0 ruby|reb|0.28.1 elastic|ria|0.13.3 slim|sia|0.1.2 vscode-styled-components|sty|1.7.5 vscode-stylelint|sty|1.2.3 lua|sum|3.5.6 ayu|tea|1.0.5 css-to-js|tgr|0.0.3 duplicate-finder|tle|0.0.6 vscode-ruby|win|0.28.0 markdown-all-in-one|yzh|3.4.3 (7 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes516:30244333 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vscaac:30438847 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 2144e591:30553903 pyindex848:30577860 40g7c324:30573242 ```
alexamy commented 1 year ago

I've made changes to my system initialization to exclude keychain. Previously I had eval 'keychain --agents ssh --eval id_rsa' command run in ~/.zshrc. (You need to replace quotes with backticks if you want to run it yourself) Now I use ssh-agent service, as described in this guide. Also add ssh-add -q ~/.ssh/id_ed25519 in ~/.zshrc.

VSCode doesn't ask passphrase anymore and can push commits to remote without fails.

alexamy commented 1 year ago

So, using ssh-agent directly as a service solves this issue.