LoginSignup
2
3

More than 5 years have passed since last update.

CentOS6標準のgitでhttpからCloneしようとすると応答が無くなる

Posted at

症状

CentOS6にyumでgitをインストールすると1.7.1とかなり古いVer.が入ります。
普通に使っている分には特に問題になりませんが、GitHubからcloneする際にhttpsではなく、httpを使うと応答が返ってこない問題があるため、注意が必要です。

HTTPSは問題なく通る

[root@host1 git]# git --version
git version 1.7.1
[root@host1 tmp]# git clone https://github.com/bsmile/zabbix.git
Initialized empty Git repository in /tmp/zabbix/.git/
remote: Counting objects: 2846, done.
remote: Total 2846 (delta 0), reused 0 (delta 0), pack-reused 2846
Receiving objects: 100% (2846/2846), 544.23 KiB | 374 KiB/s, done.
Resolving deltas: 100% (1560/1560), done.

HTTPだと応答が返ってこない

[root@host1 tmp]# git clone http://github.com/bsmile/zabbix.git
Initialized empty Git repository in /tmp/zabbix/.git/
止まる

原因

素直にhttpsを使えば良い話ではありますが、折角なので調べてみました。
curlでgithub.comに問い合わせるとHTTPSにリダイレクトされている様子。ということで、gitリポジトリにあるRelease noteを「redirect」でgrepしてみたところ、1.7.3.4にこんなのが。

* Smart HTTP transport used to incorrectly retry redirected POST  request with GET request.

折角なので複数Ver.を入れて実際に試してみました。

1.7.3.4の場合はHTTPでも正常に取得できる

[root@host1 git]# git --version
git version 1.7.3.4
[root@host1 tmp]# git clone http://github.com/bsmile/zabbix.git
Cloning into zabbix...
remote: Counting objects: 2846, done.
remote: Total 2846 (delta 0), reused 0 (delta 0), pack-reused 2846
Receiving objects: 100% (2846/2846), 544.23 KiB | 362 KiB/s, done.
Resolving deltas: 100% (1560/1560), done.

1.7.3.3の場合は応答が返ってこない

[root@host2 git]# git --version
git version 1.7.3.3
[root@host2 git]# git clone http://github.com/bsmile/zabbix.git
Cloning into zabbix...
止まる

ソースから入れている分には特に問題になりませんが、yumで入れた場合には覚えておくと嵌らずに済むかもしれませんね。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3