CentOSでgitのproxy越えにハマる

githubなんかからgitのレポジトリを落とそうとすると,https://とgit://がありますが,httpのプロクシしか立っていないためにhttps://で落とそうとしてもエラーになりました.

> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
fatal: Unable to find remote helper for 'https'
> setenv https_proxy http://proxy
> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
fatal: Unable to find remote helper for 'https'

どうもプロクシ以前の問題の気がするので調べると,INSTALLファイルにこんな記述が.

- "libcurl" library is used by git-http-fetch and git-fetch. You
might also want the "curl" executable for debugging purposes.
If you do not use http:// or https:// repositories, you do not
have to have them (use NO_CURL).

逆に言うと,httpやhttpsを使う時は,libcurlが必要っぽい.なので,curlを入れてから,そのcurlのlibcurlをリンクしたgitを作ることにします.

> wget http://curl.haxx.se/download/curl-7.21.7.tar.bz2
> tar xvf curl-7.21.7.tar.bz2
> cd curl-7.21.7
> ./configure --prefix=/usr/local
configure: Configured to build curl/libcurl:
(適当に抜粋)
curl version: 7.21.7
Host setup: i686-pc-linux-gnu
SSL support: enabled (OpenSSL)
Build libcurl: Shared=yes, Static=yes
Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP
> make -j 2
> su
# make install
exit
> cd
> wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2
> tar xvf git-1.7.6.tar.bz2
> cd git-1.7.6
> env LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure --prefix=/usr/local
> make -j 2
CC http.o
In file included from http.c:1:
http.h:6:23: error: curl/curl.h: No such file or directory
http.h:7:23: error: curl/easy.h: No such file or directory
In file included from http.c:1:
http.h:46: error: expected specifier-qualifier-list before ‘CURLcode’
http.h:51: error: expected specifier-qualifier-list before ‘CURL
http.h:97: error: ‘CURL_ERROR_SIZE’ undeclared here (not in a function)

おっと...環境変数が伝搬していないのか...では改めて

> setenv CPPFLAGS -I/usr/local/include
> setenv LDFLAGS -L/usr/local/lib
> ./configure --prefix=/usr/local
> make -j 2
> su
# make install
# exit
> cd
> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
remote: Counting objects: 11350, done.
remote: Compressing objects: 100% (2402/2402), done.
remote: Total 11350 (delta 8968), reused 11279 (delta 8910)
Receiving objects: 100% (11350/11350), 7.76 MiB | 1.86 MiB/s, done.
Resolving deltas: 100% (8968/8968), done.

OK!!!
ちなみに,環境変数https_proxyの設定を忘れると次のようになります.

> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
error: Couldn't resolve proxy 'proxy' while accessing https://github.com/imatix/zguide.git/info/refs

fatal: HTTP request failed
> setenv https_proxy http://proxy
> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/imatix/zguide.git/info/refs

fatal: HTTP request failed

あり?SSL証明書関係のエラーが.なんでマシンによって挙動が変わるんだろう.仕方がないので,

> setenv GIT_SSL_NO_VERIFY true
> git clone https://github.com/imatix/zguide.git
Cloning into zguide...
remote: Counting objects: 11350, done.
remote: Compressing objects: 100% (2402/2402), done.
remote: Total 11350 (delta 8968), reused 11279 (delta 8910)
Receiving objects: 100% (11350/11350), 7.76 MiB | 2.29 MiB/s, done.
Resolving deltas: 100% (8968/8968), done.

OK!!!!!
CURLOPT_SSL_VERIFYPEERとかでもできそうな気がするのですが,何パターンか試してうまくいかなかったので諦めました.