Git 1.8.0支持与gnome-keyring的集成。
http://www.h-online.com/open/news/item/Git-1-8-0-can-access-Windows-and-GNOME-keyrings-1733879.html
在阅读了关于git credentials helpers的文档之后:http://git-scm.com/docs/gitcredentials.html
我无法找到使用这个新功能的方法。我如何整合它?我使用的是Archlinux,从Archlinux的仓库安装了git。(git 1.8.0)
9条答案
按热度按时间lsmd5eda1#
@marcosdsanchez的答案是Arch(它回答了最初的问题),但我在Ubuntu上。对于git >= 2.11:
对于git < 2.11:
8hhllhi22#
Git 1.8.0支持gnome-keyring,但需要为您的平台编译二进制文件。
这是在Archlinux中为我解决的问题:
@VonC解决方案已关闭,但git config命令应指向可执行文件。这就是为什么它对我不起作用。
ki0zmccv3#
2016年第四季度更新:
(See“Error when using Git credential helper with
gnome-keyring
“)(See“How to sign out in Git Bash console in Windows?”:即**Git for Windows**使用最新的Microsoft Git Credential Manager for Windows)
提醒:
libgnome-keyring
是特定于GNOME的,并且是:原始答案(2012)
适用于Windows、Mac和Unix平台的Credential Helpers首先在"git-credential-helper" repo中引入,现在已包含在git发行版中:
此存储库包含一组Git凭证帮助器(
gitcredentials
(7)),它们是git
的一部分(或打算在将来贡献)。构建时,它将安装在
/path/to/git/credential
目录中。要使用这个后端,您可以通过设置将其添加到您的(全局)Git配置中
(here对于Unix):
Windows注意事项:
我想你可以在Windows上运行一个程序,并调用一个像“pypi keyring 0.10”这样的库。
但这是后端,你不能直接从Git使用它。
您正在使用的是一个“凭证助手”(它将依次调用any credential API it wants on Windows)。
GitHub for Windows提供了这样一个帮助程序(作为一个名为...
github
),并且可以在Windows会话期间存储您的凭据。从“GitHub for Windows”窗口启动一个shell,你会看到,输入“
git config --system -l
”:credential.helper=!github --credentials
部分将调用凭据帮助程序'github
'。stszievb4#
2018年10月更新
GNOME已弃用libgnome-keyring并将其替换为libsecret。Commit https://github.com/git/git/commit/87d1353a6a添加了一个新的凭据帮助器/usr/libexec/git-core/git-credit-libsecret。
git config --global credential.helper libsecret
ykejflvf5#
对于Fedora上的任何人,我稍微编辑了James Ward的回答:
bd1hkmkf6#
只需将以下两行添加到
~/.gitconfig
文件中:下次Git要求你输入密码时,输入的密码将保存到Gnome Keyring(你可以使用
seahorse
工具看到这一点),之后不会再要求你输入密码。这假设你的Git版本足够新(比如2.1.0),并且你使用的是Linux Fedora、RHEL或CentOS。对于旧版本或其他操作系统/发行版,请查看其他答案。
llew8vvj7#
在Fedora上,您需要安装
并编辑你的git配置以使用凭证助手。
仅供参考的是,
libsecret
包最近被拆分了,请参阅post from @rugk。这就是为什么用户需要重新安装此软件包的原因。xmq68pz98#
一些发行版确实将此集成作为安装包提供,而不需要任何编译。根据您的GNOME版本,您需要安装
gnome-keyring
或libsecret
版本的软件包,类似于git-credential-gnome-keyring
(OpenSUSE Leap 42.3)。但是,这本身并不会自动启用Git与GNOME Keyring的集成。您仍然必须配置Git以使用这种凭证存储方法:
hsvhsicv9#
我在 headless server 上尝试the answer for Ubuntu,输入令牌时出现以下错误:
下面是我在无头服务器上使用的解决方案(参见https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems):
git-credential-libsecret
设置为credential.helper
:git push
),我运行:这将运行一个D-Bus会话,I可以在其中运行例如
git push
等具有自动身份验证的程序。