ruby-on-rails - Windows 版 Git 收到未知协议(protocol)错误

标签 ruby-on-rails ruby windows git iis

我正在尝试在带有 IIS 的 Windows 服务器上设置 Ruby on Rails 应用程序 (OpenProject)。到目前为止,我已经启动并运行了新的 Helicon Zoo v4 ( https://github.com/helicontech/zoo ),并安装了 Ruby 2.3 和基本的 Ruby 模板。当我运行 OpenProject 的安装脚本时:

bundle install --deployment --without postgres sqlite development test therubyracer docker

当 Git 尝试从 GitHub 克隆时,我收到未知协议(protocol)错误。

bundle install --deployment --without postgres development test therubyracer 
docker Fetching gem metadata from https://rubygems.org/...... 
Fetching version metadata from https://rubygems.org/.. 
Fetching dependency metadata from https://rubygems.org/. 
Fetching https://github.com/carrierwaveuploader/carrierwave 
fatal: unable to access 'https://github.com/carrierwaveuploader/carrierwave/': 
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

我确信这个问题很容易解决,比如指定使用 TLS 而不是 SSLv3,但我还没有通过命令行找到与 Windows 版 Git 相关的任何内容。我仍在寻找,但我想我应该问问是否有人有想法?

编辑:打开跟踪和详细 curl 消息会输出更好的错误:

bundle install --deployment --without postgres development test therubyracer docker
Fetching gem metadata from https://rubygems.org/......
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Fetching https://github.com/carrierwaveuploader/carrierwave
    * Couldn't find host github.com in the _netrc file; using defaults
    * timeout on name lookup is not supported
    *   Trying 192.30.253.113...
    * TCP_NODELAY set
    * Connected to github.com (192.30.253.113) port 443 (#0)
    * ALPN, offering http/1.1
    * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
    * successfully set certificate verify locations:
    *   CAfile: C:/Git/mingw64/ssl/certs/ca-bundle.crt   CApath: none
    * error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
    * Curl_http_done: called premature == 1
    * stopped the pause stream!
    * Closing connection 0 fatal: unable to access 'https://github.com/carrierwaveuploader/carrierwave/': error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

将 Git/usr/bin 文件夹添加到路径中,我可以从 ruby​​ Web 控制台查看curl:

D:\inetpub\wwwroot\openproject>where curl
C:\Git\usr\bin\curl.exe

D:\inetpub\wwwroot\openproject>curl --version
curl 7.51.0 (x86_64-pc-msys) libcurl/7.51.0 OpenSSL/1.0.2j zlib/1.2.11 libssh2/1.7.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: Debug IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets Metalink

尝试使用以下命令设置 git 协议(protocol): git config --global http.sslVersion sslv3

* Couldn't find host github.com in the _netrc file; using defaults
* timeout on name lookup is not supported
*   Trying 192.30.253.112...
* TCP_NODELAY set
* Connected to github.com (192.30.253.112) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
* Curl_http_done: called premature == 1
* stopped the pause stream!
* Closing connection 0
fatal: unable to access 'https://github.com/carrierwaveuploader/carrierwave/': error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

最佳答案

documented here “协议(protocol)未知”的所有原因。

routines:SSL23_GET_SERVER_HELLO:unknown protocol 错误是重定向问题。
检查您的proxy settings你有吗?

如果一切都失败...尝试切换到 ssh

git config url."<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2f48465b6f48465b475a4d014c4042" rel="noreferrer noopener nofollow">[email protected]</a>/".insteadOf https://github.com/

Couldn't find host github.com in the _netrc file; using defaults
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

看起来你是using an old openSSL .

确保:

  • 解压缩适用于 Windows 的最新 Git(今天发布的 2.11.1:PortableGit-2.11.1-64-bit.7z.exe:自动解压存档)
  • 将您的PATH设置为:

    set PATH=C:\path\to\Git\bin;C:\path\to\Git\usr\bin;%PATH%
    

(首先在您的路径中设置 Git)

并确保指定:

git config --global http.sslVersion sslv3

然后再试一次。

关于ruby-on-rails - Windows 版 Git 收到未知协议(protocol)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41993808/

相关文章:

ruby-on-rails - 传递对象或对象 ID?

c++ - 为什么按下的键的 dwControlKeyState 与常量不匹配?

database - 我可以在 Azure 上发布具有非关系数据库的 Web 应用程序吗?

ruby-on-rails - rails authenticate_or_request_with_http_basic

Javascript window.open 返回未定义

ruby-on-rails - Rails迁移更改顺序或顺序

javascript - 在 Ruby 中动态命名数组/哈希

Ruby:获取对象之间不同属性的列表

ruby - 如何删除字符串的一部分?

python - Vagrant w/windows 作为主机,由于 crlf,文件不在 vm 上运行