cygwin git "Protocol "https“libcurl 不支持或禁用”

cygwin git "Protocol "https" not supported or disabled in libcurl"

我在 Windows 7 下使用 cygwin。一切都很好,直到有一天我发现我无法使用 git 克隆 github 存储库,它说 "Protocol "https“libcurl 不支持或禁用”。但是当我输入 "curl --version" 它说

curl 7.39.0 (x86_64-unknown-cygwin) libcurl/7.39.0 OpenSSL/1.0.1k zlib/1.2.8 libidn/1.29 libssh2/1.4.2 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: Debug IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP Metalink

我认为这意味着 curl 支持 https。谁能帮我?提前致谢。

I think this means https is supported by curl.

更准确地说,GitHub 不再允许该特定版本的 curl(在提出问题时,2015 年 1 月):参见 bagder/curl/issues/267

那个问题指的是新的 GitHub SSL report, and its corresponding announcement:

To keep GitHub as secure as possible for every user, we will remove RC4 support in our SSL configuration on github.com and in the GitHub API on January 5th 2015.

尝试升级 curl:current package (July 2015) 是 curl-7.43.0-1。


注意:除了 Cygwin,您可以在任何地方使用 latest Git for Windows: simply uncompress PortableGit-2.4.5.1-4th-release-candidate-64-bit.7z.exe 并启动 bash 会话(就像一个轻量级的 cygwin,有 200 多个 Linux 命令)。

C:\path\to\PortableGit-2.4.5.1-4th-release-candidate-64-bit\git-bash.exe

包括与 GitHub 兼容的 curl:

$ curl --version
curl 7.43.0 (x86_64-w64-mingw32) libcurl/7.43.0 OpenSSL/1.0.2c zlib/1.2.8 libidn/1.30 libssh2/1.6.0 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: IDN Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP

作为使用 HTTPS 的解决方法,您可以切换为使用 SSH 作为 git 的协议。当我克隆存储库时,我通常使用 SSH,因为它更灵活一些,而且有时我必须处理代理。更改协议可以通过切换 GitHub 遥控器的 URL 来完成。如果你列出你当前拥有的遥控器,你会看到类似的东西(假设你在你的项目目录中):

origin  https://github.com:someuser/project.git (fetch)
origin  https://github.com:someuser/project.git (push)

您可以将 https:// 切换为 git@git://,并为您正在使用的计算机切换 add SSH keys to git。然后,您将能够通过 SSH 连接到 GitHub,并通过 SSH 协议检出 git 存储库,避免使用 HTTPS。在 GitHub 上设置 public 密钥后,您将能够通过无密码 SSH 进入 GitHub.com,并访问 GitHub 存储库。

您可以使用 git remote set-url 命令 as documented here 从 HTTPS 切换到 SSH 协议。您将向它传递远程名称,默认情况下为 origin:

git remote set-url origin git@github.com:someuser/project.git

你应该可以开始了。