如何在WSL(Windows上的Ubuntu)上使用Git凭证存储? [英] How to use Git credential store on WSL (Ubuntu on Windows)?

查看:280
本文介绍了如何在WSL(Windows上的Ubuntu)上使用Git凭证存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试按照以下说明进行操作: https://stackoverflow.com/a/40312117/21728 做到这一点:

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

我想这是合乎逻辑的,因为确实没有X11显示屏.

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

如何在Windows(WSL)的Ubuntu上使Git凭据缓存起作用?

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

推荐答案

如果您安装了Windows版Git,则系统上安装了Windows集成凭据管理器.

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

您可以从WSL运行Windows可执行文件,如

You can run windows executables from WSL as found here.

要使用它,您可以运行以下命令(假设Windows的git安装在C:\ Program Files \ Git上)

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.exe"

这篇关于如何在WSL(Windows上的Ubuntu)上使用Git凭证存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆