簡體   English   中英

使用 Git for Windows 收到未知協議錯誤

[英]Receiving an unknown protocol error with Git for windows

我正在嘗試在帶有 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 克隆時遇到未知協議錯誤。

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,但我還沒有通過命令行找到與 Git for Windows 相關的任何內容。 我仍在尋找,但我想我會問是否有人有想法?

編輯:打開跟蹤和詳細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 設置協議: 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

在這里記錄了“協議未知”的所有原因。

routines:SSL23_GET_SERVER_HELLO:unknown protocol錯誤是重定向問題。
檢查您的代理設置是否有。

如果一切都失敗了...嘗試切換到 ssh

git config url."git@github.com/".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

看起來您正在使用舊的 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%

(首先在你的 PATH 中設置 Git)

並確保指定:

git config --global http.sslVersion sslv3

然后再試一次。

感謝VonC提供的故障排除技巧! 我們的一位服務器工程師查看了他的回答並確認我們確實有一個我不知道的自動代理。 我能夠使用多種答案來解決這個問題。

這個答案中收集,我打開了一個 Windows 命令提示符並輸入:

ping wpad

我們碰巧有共同的設置,所以這證實了服務器存在。 然后我從瀏覽器中檢索了 wpad 文件(鏈接答案中的詳細信息)並查看它以找到代理。 我們每個站點都有不同的服務器,所以我不得不尋找我的位置和特定的代理服務器。

從這里,回到 Helicon Zoo Web 控制台,我使用 VonC 的另一個答案中的此命令為 Git 設置代理設置:

git config --global http.proxy http://proxyserver:port

用實際值替換代理服務器和端口。 最后,我能夠從 github 克隆。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM