Running gnome-keyring on WSL (Windows Subsystem for Linux)

I've been trying to store HTTPS GIT credentials using a Keyring (Gnome Keyring) using the steps in this article:

http://blog.iqandreas.com/git/storing-https-authentication-in-ubuntu-and-arch-linux/

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-keyring

Now when I use any remote git command, I get the error:

** (process:19273): CRITICAL **: Error communicating with gnome-keyring-daemon

Is 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: https://blogs.msdn.microsoft.com/wsl/

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
fi

And it told me to install 2 more dependencies:

sudo apt-get install dbus-x11
sudo apt-get install gnome-keyring

but 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 directory

And 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.

Solution 1:

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
fi

Credentials 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 used

source: https://www.reddit.com/r/bashonubuntuonwindows/comments/4yhch4/using_gnomekeyringdaemon_for_ssh_keys/

Solution 2:

You don't need the modifications in your .bashrc

Install keyrings.alt

sudo pip install keyrings.alt