GNOME comes with libsecret. You can use libsecret to store your git credentials:
sudo apt install libsecret-1-0 libsecret-1-dev libglib2.0-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
Then, create a personal access token on github/gitlab. Remember that the username does not matter when using a PAT: you can just use foo
as username.
To list the secrets stored, you can use lssecret
:
git clone https://github.com/gileshuang/lssecret /tmp/lssecret
cd /tmp/lssecret
make && DESTDIR=/usr/local sudo make install
% lssecret
Collection: Login
Collection:
Collection: Default
Item: Git: https://gitlab.com
Key: protocol
Value: https
Key: user
Value: foo
Key: server
Value: gitlab.com
Key: xdg:schema
Value: org.gnome.keyring.NetworkPassword
Item: https://some.note.i.created
Key: xdg:schema
Value: org.gnome.keyring.Note
Item: github-pat
Key: xdg:schema
Value: org.gnome.keyring.Note
Item: vscode-insidersvscode.github-authentication/github.auth
Key: account
Value: github.auth
Key: service
Value: vscode-insidersvscode.github-authentication
Key: xdg:schema
Value: org.freedesktop.Secret.Generic
To fetch secrets, you can use secret-tool
:
sudo apt install libsecret-tools
secret search
Thanks, but I think you forgot to add
gcc
to the list of installed packages.When following the instructions on Ubuntu Desktop 20.04, I get the following error: