Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Git credential store on WSL (Ubuntu on Windows)?

I've tried following these instructions: https://stackoverflow.com/a/40312117/21728 which basically do this:

sudo apt-get install libsecret-1-0 libsecret-1-dev cd /usr/share/doc/git/contrib/credential/libsecret sudo make git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret 

But when I do any network operation, I get this error:

** (process:7902): CRITICAL **: could not connect to Secret Service: Cannot autolaunch D-Bus without X11 $DISPLAY 

That's logical I guess as there is indeed no X11 display.

How to make Git credentials caching work on Ubuntu on Windows (WSL)?

like image 615
Borek Bernard Avatar asked Aug 28 '17 19:08

Borek Bernard


People also ask

Can I use git in WSL?

Git can be installed on Windows AND on WSL The root of your file system / is the mount point of your root partition, or folder, in the case of WSL. Not everything under / is the same drive. For example, on my laptop, I've installed two version of Ubuntu (20.04 and 18.04), as well as Debian.

How do I add a git credential to Windows?

Go to Windows Credentials -> Generic Credentials. Here your credential should be listed if everything is working correctly. Git should add it by default the first time you log in to a new repository.

Where is git credentials stored Ubuntu?

The . git-credentials file is stored in plaintext. Each credential is stored on its own line as a URL like: https://user:[email protected] When Git needs authentication for a particular URL context, credential-store will consider that context a pattern to match against each entry in the credentials file.


1 Answers

If you installed Git for Windows there is a windows integrated credential manager installed on your system.

You can run windows executables from WSL as found here.

To use it you can run the following command (assuming that your git for windows is installed on C:\Program Files\Git)

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe" 
like image 131
Carlos Beppler Avatar answered Sep 26 '22 07:09

Carlos Beppler