【问题标题】:Curl Initialization error with git pre-push hookgit pre-push 钩子的卷曲初始化错误
【发布时间】:2017-09-19 22:13:18
【问题描述】:

我创建了一个 git pre-push 挂钩来检查被推送的提交。 验证步骤之一使用 cURL 获取一些数据以验证提交。在运行 git push 时,cURL 无法初始化并出现错误

curl: (2) Failed initialization

预推送挂钩具有正确的权限(-rwx------)。为了缩小问题范围,我从脚本中删除了除 cURL 命令之外的所有内容,并且我能够使用非常简单的脚本重现错误

#!/bin/sh
/usr/bin/curl "http://www.google.com"

脚本在独立运行时按预期工作。

其他细节:

我。 Git 已添加到路径中

二。 curl 版本:curl 7.24.0 (x86_64-redhat-linux-gnu)

我非常感谢您对此的任何帮助。

【问题讨论】:

    标签: git shell curl githooks


    【解决方案1】:

    检查curlldd /usr/bin/curl 一起使用的内容,如in this answer

    in this issue 所示,您可能需要调整LD_LIBRARY_PATH 以引用实际使用的库。

    【讨论】:

    • 我可以从 shell 运行 curl 而不会出现任何错误。我只从 git hooks 得到初始化错误。我也尝试设置一个预提交钩子,我得到了同样的错误。 ldd /usr/bin/curl | grep libcurl.so.4libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007f7e7e53b000)
    • @arpitpanwar 你的操作系统(uname -acat /etc/os-release)和 Git 版本是什么?
    • 感谢分享文章。我阅读并尝试重新安装 curl 但仍然没有运气。此外,我计划将预推送脚本分发给其他人,因此我不希望设置太难。 uname -aLinux <hostname> 3.2.45-0.6.wd.865.49.315.metal1.x86_64 #1 SMP Fri Apr 1 10:12:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux。 Git 版本 2.7.3.AMZN。
    • 是否有可能将 git 升级到 2.12.2? (只是看看问题是否仍然存在)
    猜你喜欢
    • 2014-02-15
    • 1970-01-01
    • 2017-07-16
    • 1970-01-01
    • 2016-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-01
    相关资源
    最近更新 更多