使用Git for windows

时间:2017-02-02 03:40:48

标签: 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克隆。

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

2 个答案:

答案 0 :(得分:1)

documented here"协议未知的所有原因"。

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

如果一切都失败了......请尝试切换到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

看起来你是using an old openSSL

请务必:

  • 解压缩最新的Git for Windows(今天发布的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

然后再试一次。

答案 1 :(得分:1)

感谢VonC提供的问题排查提示!我们的一位服务器工程师看了他的答案,并确认我们确实有一个我不知道的自动代理。我能够使用各种答案来解决这个问题。

this answer收集我打开了一个Windows命令提示符并输入:

ping wpad

我们碰巧有了常见的设置,因此确认服务器存在。然后我从浏览器中检索了wpad文件(链接答案中的详细信息)并查看它以查找代理。我们每个站点都有不同的服务器,所以我不得不寻找我的位置和特定的代理服务器。

从这里开始,在Helicon Zoo Web控制台中,我使用此命令从另一个VonC answers设置Git的代理设置:

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

用实际值替换proxyserver和port。最后,我能够从github克隆。