今回はvimのプラグイン管理ツールを使おうとしたらGit周りでエラーがでた、というお話です。 原因と対処法が判ったので、覚え書きに記録を残しておきます。
gitでhttpsアクセスできないっ
vimのプラグイン管理にNeoBundleを使ってみようと思い、CygwinでNeoBundleを設定して、実行したら、こんなメッセージが..
$ vim Not installed bundles: ['codic-vim'] Install bundles now? (y)es, [N]o: y [neobundle/install] Update started: (2014/03/19 22:15:41) [neobundle/install] (1/1): |codic-vim| git clone --recursive https://github.com/koron/codic-vim.git "/cygdrive/d/home/tar/.vim/bundle/codic-vim" [neobundle/install] (1/1): |codic-vim| Error /cygdrive/d/home/tar/.vim/bundle/codic-vim [neobundle/install] Installed/Updated bundles: no new bundles installed [neobundle/install] Error installing bundles: codic-vim Please read the error message log with the :message command. 続けるにはENTERを押すかコマンドを入力してください
んー?リポジトリのアドレスを間違えたかな〜と思い、直接gitコマンドを実行してみると..
$ git clone https://github.com/koron/codic-vim.git . Cloning into '.'... fatal: Unable to find remote helper for 'https'
あれ?SSHではちゃんとclone出来たのに、httpsでアクセスできない??
原因
少し調べてみると、Ubuntuで同じエラーがでた人がいたので、そちらを参考にさせていただきました。
Gitで"fatal: Unable to find remote helper for 'https'"の対処法 - DQNEO起業日記
どうやら原因は、curlライブラリがインストールされていないのと、Gitのconfigureで--with-curl
のオプションを付けていなかったこと。
確かに前回Gitをmakeしたときに--with-curl
のオプションは付けてなかったし、curlライブラリもインストールしてませんでした。
インストール時の記録が残っていたので、すぐに気がつけました。やっぱり記録は重要ですね。
対処法
Cygwinでcurl辺りをインストールするならapt-cyg install curl libcurl-devel
としておけば良いでしょう。あとは先のサイトで見つけたGitのconfigureオプションの意味を調べておきました。
Gitのリポジトリをcloneしたディレクトリで、./configure --help
を使ってみるとオプションの説明が確認できます。
$ ./configure --help : --with-curl support http(s):// transports (default is YES) ARG can be also prefix for curl library and headers --with-expat support git-push using http:// and https:// transports via WebDAV (default is YES) ARG can be also prefix for expat library and headers :
なるほど、--with-curl
はhttp転送を使うためのオプションだけど、デフォルトでYESになってるから、curlライブラリが入っていれば有効になるようです。あと--with-expat
オプションはpushでhttp転送使うためのオプションですね。こちらもデフォルトでYESになってるようです。
まあ、今回は念のため、このオプションを明示的に有効にしてmakeしておこうと思います。
CygwinのGitバージョンを最新にしながら、インストール手順を見直してみる
以前、Qiitaに Cygwin で RubyとGitをコンパイルして使おう - Qiita を投稿したのですが、当時のGitバージョンは1.8.5、2014/3/19現在の最新は1.9.1。折角なので、Gitを最新にするついでに、CygwinにGitを入れる要点をもう一度見直しておきます。
Cygwin Setupでのパッケージ選択
GUIのCygwin Setupを使うのは、一番最初のインストールの時だと思います。その際パッケージ選択は、標準選択されているものの他に、下記3つを追加で選択しておきます。
Devel/git
Utils/bzip2
Web/wget
GUIのCygwin Setupでは出来るだけ最小インストールし、次の apt-cyg コマンドを使ってパッケージをインストールしていきます。
apt-cygでのパッケージインストール
$ apt-cyg install gcc-core $ apt-cyg install make patch vim $ apt-cyg install libncurses-devel openssl-devel readline libsqlite3-devel libxml2-devel libxslt-devel $ apt-cyg install autoconf zlib zlib-devel libiconv python openssh tcl $ apt-cyg install gettext-devel $ apt-cyg install curl libcurl-devel
最後の1行でcurlライブラリをインストールしてます。
Gitのmakeとインストール
$ cd /tmp $ git clone git://github.com/git/git.git $ cd git $ make configure $ make configure $ ./configure --prefix=/usr/local --with-curl --with-expat $ make all $ make install
インストールが完了したら、Gitのバージョンを確認してみましょう。
$ git --version git version 1.9.1.286.g5172cb3
ちゃんと最新になってればOKです。
再度httpsアクセスを試みる
$ git clone https://github.com/koron/codic-vim.git . Cloning into '.'... remote: Reusing existing pack: 67, done. remote: Total 67 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (67/67), done. Checking connectivity... done.
よしっ!今度はうまくhttpsでアクセスできました。
あとがき
トラブっても、うまく対処できると気分がいいものですね^^