我试着遵循这些指令:https://stackoverflow.com/a/40312117/21728,它基本上做到了这一点:
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但是当我做任何网络操作时,我得到这个错误:
** (process:7902): CRITICAL **: could not connect to Secret Service: Cannot autolaunch D-Bus without X11 $DISPLAY我想这是合乎逻辑的,因为确实没有X11显示屏。
如何让Git凭证缓存在Ubuntu on Windows (WSL)上工作?
发布于 2017-11-17 20:04:42
如果您安装了Git for Windows,则系统上已安装windows集成凭据管理器。
你可以从WSL运行windows可执行文件,就像找到here一样。
要使用它,您可以运行以下命令(假设您的git for windows安装在C:\Program Files\Git上)
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"发布于 2018-08-03 17:23:31
TL;DR
我已经创建了a script that does this for you。我在我的厨师编排中使用它。
找到或安装git-credential manager.exe
cmd.exe并调用where git-credential-manager.exe ,则为
cmd.exe call where git.exe C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager.exe
where获取路径。从DOS到Linux的路径转换
我们需要:
用双反斜杠/mnt/c/
C:\将\中的斜杠替换为/
\\所以..。
"C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager.exe" becomes..."/mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"我上面的脚本有一个函数可以做到这一点
dos_path_to_linux(){
sed -e 's?\\?/?g' -e' s?[cC]:?/mnt/c?' <<<"$1"
}但是,作为@12345ieee has since commented,WSL build 17046中添加了一个wslpath实用程序。这是值得一查的,但我目前无法访问Windows进行验证。(请注意,尽管我的链接中的发行说明中给出了用法说明,但似乎命令doesn't currently include a usage statement、-h等)
配置git
call git config --global credential.helper "<converted/path>"中的
bash发布于 2018-02-05 22:32:27
使用Windows10和"WSL",我创建了一个~/.gitconfig文件,但将凭证部分标签错误地键入为凭证。我尝试运行git credential fill,然后将其输出提供给git credential approve,这可能会起作用,但我怀疑没有,因为它显示了"usage: git credential fill|approve|reject“。最后,我简单地运行:
$ git config --global credential.helper cache然后执行git命令;当系统提示输入用户名和密码时,我照常输入它们。在那之后,它记住了这一点。我发现它已经将(正确命名的)部分添加到我的~/.gitconfig中:
[credential]
helper = cache我对其进行了编辑,以提供更长的超时时间:
[credential]
helper = cache --timeout=144000现在一切似乎都运行得很好。
https://stackoverflow.com/questions/45925964
复制相似问题