http経由の git コマンド(push,clone,fetch..)等がなんかうまく動かないときにデバッグする方法
git push、git pull なんかがどうにもこうにもエラーだなーって時に使えるかもしれないワザ。 リモートレポジトリのURLがhttp/https の場合に限るです。
GitBucketを使った際に、 git cloneできない問題 に引っかかった時にデバッグで使用しました。 環境変数「GIT_CURL_VERBOSE=1」を設定しておくと、通信内容(curl)のDEBUGを出すことができますという話。
$ GIT_CURL_VERBOSE=1 git clone http://localhost:18080/gitbucket/git/root/test01.git Cloning into 'test01'... * Couldn't find host localhost in the .netrc file; using defaults * About to connect() to localhost port 18080 (#0) * Trying ::1... * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 18080 (#0) * Connected to localhost (127.0.0.1) port 18080 (#0) > GET /gitbucket/git/root/test01.git/info/refs?service=git-upload-pack HTTP/1.1 User-Agent: git/1.8.3.2 Host: localhost:18080 Accept: */* Accept-Encoding: gzip Pragma: no-cache < HTTP/1.1 200 OK < Server: Apache-Coyote/1.1 < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Pragma: no-cache < Cache-Control: no-cache, max-age=0, must-revalidate < Content-Encoding: gzip < Content-Type: application/x-git-upload-pack-advertisement;charset=UTF-8 < Content-Length: 192 < Date: Mon, 08 Jul 2013 14:22:22 GMT < * Connection #0 to host localhost left intact fatal: http://localhost:18080/gitbucket/git/root/test01.git/info/refs not valid: is this a git repository?