gpt4 book ai didi

linux - 使用带有 gnome-keyring 的 Git 凭证助手作为 Sudo 时出错

转载 作者:IT王子 更新时间:2023-10-29 00:19:59 26 4
gpt4 key购买 nike

我一直在寻找一种在连接到使用 SSL 的 Git 服务器时安全地存储凭据的方法。我遇到了@james-ward 的这个建议(我所做的唯一编辑是我更新了我们的“系统”配置而不是我们的 Git 的“全局”配置(https://stackoverflow.com/a/14528360/6195194)

sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --system credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

然后我就可以跑了

git clone https://ipaddress/git/repo.git

凭证助手将存储我的凭证,但是当我运行以下命令时:

sudo git clone https://ipaddress/git/repo.git testfolder

它给我以下错误

** (process:3713): CRITICAL **: Error communicating with gnome-keyring-daemon

我有时需要运行 sudo git clone 因为有时我需要创建克隆的目录需要它。任何帮助将不胜感激。

我使用的版本: - git 版本 1.9.1 - Ubuntu 服务器 14.0.4

提前致谢!-理查德 O.

最佳答案

除了使用 sudo,请注意,在 2016 年,libgnome-keyring 是特定于 GNOME 的,现在已弃用(自 January 2014, actually 起)。

2022 选项:git-credential-manager

Microsoft 提供了一个名为 GCM (Git Credential Manager) 的跨平台凭证助手,这 you can install (无需构建它)并配置:

git-credential-manager-core configure

您需要 Git 2.27+ 才能使用它。


2016 选项:git-credential-libsecret

Git 2.11+(2016 年第 4 季度)包括一个使用 libsecret 的新凭证助手.

参见 commit 87d1353 (2016 年 10 月 9 日)Mantas Mikulėnas (grawity) .
(由 Junio C Hamano -- gitster -- merge 于 commit bfe800c ,2016 年 10 月 26 日)

A new credential helper that talks via "libsecret" with implementations of XDG Secret Service API has been added to contrib/credential/.

it uses libsecret which can support other implementations of XDG SecretService API.

但在 2022 年,这将不再需要。见上文


mati865 所述在 the comments :

It should be noted that some distros like Arch and Fedora provide helpers available as both binary and source.

  • Libsecret binary on Arch: /usr/lib/git-core/git-credential-libsecret, and
  • Libsecret binary on Fedora: /usr/libexec/git-core/git-credential-libsecret.

注:@rugk在评论中添加,for Fedora and Git v2.25.2-1 or higher ,你需要用那个二进制文件安装一个额外的包,因为 it has been split from the main git package :

dnf install git-credential-libsecret

关于linux - 使用带有 gnome-keyring 的 Git 凭证助手作为 Sudo 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36585496/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com