I am using Git from the VS Code terminal on Ubuntu. For some reason, it started to ask me to unlock my SSH key every time I wanted to push/pull. Here are a few things to try first:

The issue is that none of the usual methods worked for me. After trying countless hacks and tricks, I finally came up with a solution: I just needed to talk to the Gnome Keyring daemon instead of ssh-agent. My setup might be oddly specific, but in case it can save your time, fellow Internet wanderer, here is my workaround.

Just add the following snippet in your .zshenv or .bash_profile:

if [ -z "$DESKTOP_SESSION" ];then
    eval $(gnome-keyring-daemon --start)
    export SSH_AUTH_SOCK
fi

Edit: I used this with Gnome Keyring version 3.36 and 40.0. It seems that newer (42+) versions don’t require this workaround anymore and can use a service instead.