I started using i3 as my window manager, and at some point started having some issues with env variables on GUI apps. This is because we usually add env variables to the shell config file, in my case the .zshrc file, however, .zshrc will set the env variables only in your shell and not all the apps.

So, when setting up a project using git with ssh and a passphrase as authentication (and after doing all the setup for the gnome keyring) I realized that my VSCode wasn’t actually using the keyring and was asking for the ssh passphrase always, however, this wasn’t happening on my shell.

Also, this wasn’t happening on VSCode if this was opened using the shell! So, clearly it was something happening when opening VSCode outside the terminal that was not inheriting the env vars to VSCode.

So, after a lot of research and tests I needed to set the ssh env var on the zsh env file: .zshenv:


Logout or reboot.

I assume this should work with other shells using the corresponding shell config file. i.e: ~/.bash_profile. You can read more about how environment variables work here.