Git with Smart HTTP in Cygwin

Executive summary: In order to use git in Cygwin with Smart HTTP style URLs, you need to also install the libsasl2 and ca-certificates packages.

I recently set up a new Cygwin environment to test and document the process of cloning and using one of the OpenXC repositories from GitHub in Windows, since this is a very popular platform for many users. Unfortunately many people were being blocked at the very first step, just attempting to clone the repository.

GitHub transitioned a little while back to using Smart HTTP by default for all public repositories. This is great because even for folks that need to commit to repositories, they can skip the SSH key dance if they aren't already using that in their daily routine. This seems to be especially the case for Windows users.

So for OpenXC, a new users installs Cygwin with the "git" package and attempts to clone the repository, and it explodes:

$ git clone https://github.com/openxc/openxc-android
Cloning into 'openxc-android'...
/usr/lib/git-core/git-remote-https.exe: error while loading shared
    libraries: ?: cannot open shared object file: No such file or directory

I was able to figure out which library was missing by using cygcheck:

$ cygcheck /usr/lib/git-core/git-remote-https.exe
C:\cygwin\lib\git-core\git-remote-https.exe
  C:\cygwin\bin\cygcrypto-0.9.8.dll
    C:\cygwin\bin\cygwin1.dll
      C:\Windows\system32\KERNEL32.dll
        C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll
        C:\Windows\system32\ntdll.dll

    ... <snip> ...

    C:\cygwin\bin\cyglber-2-4-2.dll
    C:\cygwin\bin\cygldap-2-4-2.dll
      C:\cygwin\bin\cygssl-1.0.0.dll
    C:\cygwin\bin\cygssh2-1.dll
cygcheck: track_down: could not find cygsasl2-2.dll

This tells me that libsasl2 is missing, so install that from the Cygwin package manager.

Try the clone again and it still fails:

$ git clone https://github.com/openxc/openxc-android.git
Cloning into 'openxc-android'...
error: error setting certificate verify locations:
  CAfile: /usr/ssl/certs/ca-bundle.crt
  CApath: none while accessing
        https://github.com/openxc/openxc-android.git/info/refs
fatal: HTTP request failed

By default, Cygwin doesn't have the CA root certificates installed, so nothing using SSL will work properly. Install the ca-certificates package to install those.

Finally, success:

$ git clone https://github.com/openxc/openxc-android
Cloning into 'openxc-android'...
remote: Counting objects: 13997, done.
remote: Compressing objects: 100% (2759/2759), done.
remote: Total 13997 (delta 7568), reused 13989 (delta 7560)
Receiving objects: 100% (13997/13997), 9.30 MiB | 1.04 MiB/s, done.
Resolving deltas: 100% (7568/7568), done.

This problem was a little difficult to debug because I don't think very many people encounter it. Typically when someone installs Cygwin, they also install a base set of packages that includes things like curl. Well, one of the curl package's many dependencies are both libsasl2 and ca-certificates, which explains why many people do not encounter this problem.


http://christopherpeplin.com/2013/01/cygwin-git-https/


转自:http://blog.csdn.net/poisonchry/article/details/17153117

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值