首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将git与gnome-keyring集成使用

如何将git与gnome-keyring集成使用
EN

Stack Overflow用户
提问于 2012-11-15 03:15:05
回答 8查看 75.7K关注 0票数 142

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凭据帮助程序的文档后:http://git-scm.com/docs/gitcredentials.html

我找不到使用这个新功能的方法。我如何集成它?我使用的是Archlinux,其中git是从Archlinux的存储库安装的。(git 1.8.0)

EN

回答 8

Stack Overflow用户

回答已采纳

发布于 2012-11-15 10:51:50

Git 1.8.0提供了gnome-keyring支持,但二进制文件需要针对您的平台进行编译。

这就是我在Archlinux中解决这个问题的方法:

代码语言:javascript
复制
$ sudo pacman -S libgnome-keyring
$ cd /usr/share/git/credential/gnome-keyring
$ make
$ git config --global credential.helper /usr/share/git/credential/gnome-keyring/git-credential-gnome-keyring

@VonC解决方案已关闭,但git config命令应指向可执行文件。这就是为什么它对我不起作用。

票数 60
EN

Stack Overflow用户

发布于 2013-01-26 02:45:34

@marcosdsanchez的答案是给Arch的(它回答了最初的问题),但我使用的是Ubuntu。对于git >= 2.11:

代码语言:javascript
复制
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

对于git < 2.11:

代码语言:javascript
复制
sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
票数 218
EN

Stack Overflow用户

发布于 2012-11-15 04:02:59

更新Q4 2016:

  • Unix,Mac (Git 2.11+)

git配置--全局credential.helper库密钥

(参见"Error when using Git credential helper with gnome-keyring")

  • 窗口:

git配置--全局credential.helper管理器

(参见"How to sign out in Git Bash console in Windows?":即使用最新的 )

原始答案(2012)

适用于Windows、Mac和Unix平台的凭证助手首先在"git-credential-helper" repo中引入,现在已经包含在git发行版

Git这个存储库包含一组

凭证助手(gitcredentials(7)),它们是git的一部分(或打算在将来提供)。

代码语言:javascript
复制
$ git clone git://github.com/pah/git-credential-helper.git
$ BACKEND=gnome-keyring      # or any other backend
$ cd git-credential-helper/$BACKEND
$ make
$ cp git-credential-$BACKEND /path/to/git/crendential

构建时,它将安装在/path/to/git/credential目录中。

要使用此后端,您可以通过设置

将其添加到(全局) Git配置中

(此处适用于Unix):

代码语言:javascript
复制
git config --global credential.helper /path/to/git/credential/gnome-keyring/git-credential-gnome-keyring

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":

代码语言:javascript
复制
C:\Users\VonC\Documents\GitHub\test [master +2 ~0 -0 !]> git config --system -l
credential.helper=!github --credentials

credential.helper=!github --credentials部件将调用凭证助手'github‘。

代码语言:javascript
复制
$ git config [--global] credential.helper $BACKEND
票数 26
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13385690

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档