VS Code cannot sign in to GitHub on Linux because of the OS keyring
Cannot create an item in a locked collectionShort answer
VS Code stores your sign-in token in the desktop keyring. If the keyring is locked, not running, or VS Code picks the wrong backend, sign-in fails. Run VS Code with the verbose OSCrypt log to see the backend, unlock the default keyring, or set the password-store runtime argument.
Fix it fast
1Find out which cause you have
Start VS Code from a terminal with the verbose flag. Then search the log for OSCrypt, password storage or selected backend to see which keyring VS Code chose.
code --verbose --vmodule="*/components/os_crypt/*=1"2Match what you see, then jump to its fix
- 1
Cannot create an item in a locked collectionThe GNOME keyring is lockedFix - 2
The log names a backend you do not use (for example a KWallet backend on a GNOME desktop)The wrong keyring backend is selectedFix - 3
Running KDE and the log shows a KWallet backend failingKDE: the wallet is closed or not reachableFix
- 1
What does the error look like?
Cannot create an item in a locked collectionGitHub sign-in in VS Code does not complete or does not stay signed in
Cause 1 of 3
The GNOME keyring is locked
1Check
The log line above means VS Code reached the keyring but the default collection, usually called Login, is locked. It is unlocked when you sign in to the OS, so autologin or a non-password login leaves it locked.
code --verbose --vmodule="*/components/os_crypt/*=1" 2>&1 | grep -i -E 'locked|backend'2Fix
Unlock the default Login keyring with a keyring manager such as Seahorse, then sign in to GitHub in VS Code again.
seahorse3Verify
Sign in again from the Accounts menu; the account stays after restarting VS Code.
code --verbose --vmodule="*/components/os_crypt/*=1"Confirmed by code.visualstudio.com
Cause 2 of 3
The wrong keyring backend is selected
1Check
VS Code detects the desktop environment itself. If it detects it wrongly, tell it the backend directly with the password-store argument. The supported values are gnome-libsecret, kwallet5, kwallet and basic.
code --password-store="gnome-libsecret"2Fix
If that start works, make it permanent: run Preferences: Configure Runtime Arguments from the Command Palette and add the value to argv.json.
{
"password-store": "gnome-libsecret"
}3Verify
Restart VS Code and sign in to GitHub again.
code --verbose --vmodule="*/components/os_crypt/*=1"Confirmed by code.visualstudio.com
Cause 3 of 3
KDE: the wallet is closed or not reachable
1Check
On KDE, VS Code needs the default wallet, kdewallet, to be open in KWalletManager.
code --verbose --vmodule="*/components/os_crypt/*=1" 2>&1 | grep -i kwallet2Fix
Open KWalletManager and open the default wallet. If VS Code still cannot connect, use a keyring that implements the Secret Service API and set password-store to gnome-libsecret.
{
"password-store": "gnome-libsecret"
}3Verify
Restart VS Code and sign in again.
code --password-store="gnome-libsecret"Confirmed by code.visualstudio.com
How do I stop it coming back?
- Sign in to your desktop with a password so the Login keyring unlocks with the session.
- Keep the password-store value in argv.json so every start uses the same backend.
- Avoid the basic backend: VS Code warns it is only obfuscation, and other processes may be able to decrypt it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
dnf cannot install MySQL on Amazon Linux 2023
dnf cannot find a mysql-server package on Amazon Linux 2023
Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.
3 causes, each with a fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix