【问题标题】:Git + libsecret throws "Cannot autolaunch D-Bus without X11 $DISPLAY"Git + libsecret 抛出“没有 X11 $DISPLAY 无法自动启动 D-Bus”
【发布时间】:2019-05-06 18:37:10
【问题描述】:

我在 CentOS 7 服务器上安装了 Git 和 libsecret。我使用 git-credentials-store 将我的凭据以明文形式存储在服务器上。现在我想使用 libsecret,但不幸的是,如果我将 git-credential-libsecret 配置为凭证助手,我会遇到 D-Bus 错误。

我已经安装了 dbus 和 dbus-x11 并通过以下命令启动了 dbus,但我仍然遇到错误。

dbus-launch --sh-syntax

错误:

$ git pull origin master

** (process:66155): CRITICAL **: 08:19:33.936: could not connect to Secret Service: Cannot autolaunch D-Bus without X11 $DISPLAY

** (process:66160): CRITICAL **: 08:19:34.209: store failed: Cannot autolaunch D-Bus without X11 $DISPLAY

编辑:

安装 gnome-keyring 后出现以下错误

** 消息:14:10:49.566:来自秘密服务的远程错误:org.freedesktop.DBus.Error.UnknownMethod:路径 /org/freedesktop/ 的对象上没有此类接口“org.freedesktop.Secret.Collection”秘密/收藏/登录

【问题讨论】:

    标签: git unix centos x11 dbus


    【解决方案1】:

    您需要使用export $(dbus-launch) 来评估dbus-launch 输出的变量,以便在您的环境中设置${DBUS_SESSION_BUS_ADDRESS}。另见:How to export DBUS_SESSION_BUS_ADDRESS

    如果您的环境中未设置${DBUS_SESSION_BUS_ADDRESS},D-Bus 客户端库将假定没有dbus-daemon 正在运行,并将尝试自动启动一个。没有${DISPLAY},这是不可能的;因此您会看到错误消息。

    【讨论】:

    • 谢谢@Philip!现在我收到以下错误 ** (process:46160): CRITICAL **: lookup failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets is not provided by any 。服务文件
    • 确保将文件org.freedesktop.secrets.service 安装到配置会话总线以查找服务的目录中。通常这是 /usr/share/dbus-1/services,但如果您使用自定义配置,可能会有所不同。我怀疑您已将 libsecret 安装在自定义前缀而不是系统范围内,这会导致此问题。您是否使用了发行版提供的 RPM?
    • 感谢您的回答 :) 我没有在文件系统上找到该文件。我已经通过提供的 yum repos 安装了 libsecret。
    • 它可能由gnome-keyring 包而不是libsecret 提供。它肯定在 Fedora 上。
    【解决方案2】:

    您可以无头运行它,但您需要遵循 Python 密钥环包中的建议来“欺骗”它。

    https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems

    【讨论】:

      猜你喜欢
      • 2015-10-23
      • 2016-09-14
      • 2022-06-27
      • 2012-01-23
      • 2018-02-07
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      • 2012-03-18
      相关资源
      最近更新 更多