I've been trying to store HTTPS GIT credentials using a Keyring (Gnome Keyring) using the steps in this article:
I took these steps:
sudp apt-get install make
sudo apt-get install-gnome-keyring-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyringNow when I use any remote git command, I get the error:
** (process:19273): CRITICAL **: Error communicating with gnome-keyring-daemonIs it just not possible to run a daemon on WSL, or am I missing something simple? Sorry if this is a different type of question, I'm new on Ubuntu.
On another note, would it be a good idea to create a synonym 'WSL' for the tag 'ubuntu-on-windows'?
I think this might become the most logical acronym for ubuntu-on-windows:
UPDATE:
I've tried what @LordMord said:
add at the end of ~/.bashrc
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then test -r ~/.gnome-keyring && \ source ~/.gnome-keyring && \ export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID ssh-add -l &>/dev/null if [ "$?" == 2 ]; then (umask 066; echo `dbus-launch --sh-syntax` > ~/.gnome-keyring; gnome-keyring-daemon >> ~/.gnome-keyring) source ~/.gnome-keyring && \ export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID fi
fiAnd it told me to install 2 more dependencies:
sudo apt-get install dbus-x11
sudo apt-get install gnome-keyringbut now I get this error on startup:
** (gnome-keyring-daemon:23): WARNING **: couldn't create socket directory: No such file or directory
** (gnome-keyring-daemon:23): WARNING **: couldn't bind to control socket: /home/wtijsma/.cache/keyring-3mToEe/control: No such file or directoryAnd this error when I try to use a remote GIT command:
Gkr-Message: couldn't connect to dbus session bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. 2 3 Answers
add at the end of ~/.bashrc
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then test -r ~/.gnome-keyring && \ source ~/.gnome-keyring && \ export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID ssh-add -l &>/dev/null if [ "$?" == 2 ]; then (umask 066; echo `dbus-launch --sh-syntax` > ~/.gnome-keyring; gnome-keyring-daemon >> ~/.gnome-keyring) source ~/.gnome-keyring && \ export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID fi
fiCredentials are automatically added to ssh-agent provided that both the public and private keys are inside ~/.ssh. Keychain storing applications such as mysql-workbench(requires Xming) also work.
You can ignore this warning on bash startup
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get usedsource:
2You don't need the modifications in your .bashrc
Install keyrings.alt
sudo pip install keyrings.alt
You can find the keyring official document about Using Keyring on headless Linux systems. This would work on WSL, Docker containers and all other headless Linux. Here is more concise instructions.
$ sudo apt-get update
$ sudo apt install -y gnome-keyring python3-pip
$ pip3 install -U --user pip keyring
$ dbus-run-session -- sh # this will drop you into a new D-bus shell
$ echo 'any_password' | gnome-keyring-daemon --unlock # unlock the system's keyring
$ keyring set system user # enter any thing
$ keyring get system userIf you just need a security service, then you can use "keyrings.alt" Python package instead of gnome-keyring. gnome-keyring was made for X11 GUI, so it is a bit painful to make it work with non-GUI. keyrings.alt is made for non-GUI. You can install keyrings.alt as follows.
pip3 install -U --user keyrings.alt"keyrings.alt" has security risks. It shouldn't be used in production environment
1