Bitbucketからcloneすると501になる
記事カテゴリ テクノロジー
投稿日: 2020年08月04日
Jump to heading 事象
[roppong@5ab5b555f345 roppongi]$ git clone https://atlassian.hogehoge.com/stash/scm/hogehoge/hogehoge.git
Initialized empty Git repository in /home/roppong/dev/hoge/roppongi/hogehoge/.git/
error: The requested URL returned error: 501 while accessing https://atlassian.hogehoge.com/stash/scm/hogehoge/hogehoge.git/info/refs
fatal: HTTP request failed
Jump to heading 環境
以下環境で実行しました。
CentOS6
[roppong@5ab5b555f345 roppongi]$ cat /etc/redhat-release
CentOS release 6.10 (Final)
[roppong@5ab5b555f345 roppongi]$
Gitのクライアントバージョンは1.7.1
Jump to heading 解決策
gitクライアントのバージョンが古かったため最新化しました。
$ sudo yum remove git
$ sudo yum install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
$ wget https://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz
$ tar -zxf git-2.2.0.tar.gz
$ cd git-2.2.0
$ make prefix=/usr/local all
$ make prefix=/usr/local install
$ git --version
参考 : https://qiita.com/sirone/items/2e233ab9697a030f1335
Jump to heading 備考
解決策を調べていたところ、Atlassianのページに行きつきました。
https://confluence.atlassian.com/stashkb/git-commands-return-error-code-501-282988872.html
原因としては、
- SmartHTTPが搭載されていない古いバージョンのgitを利用している。
- Bitbucketの一時的な問題
とのことで、 解決策として、以下が示されていました。
1.の場合、 Gitクライアントのバージョンを1.6.6以上に上げる
2.の場合、 時間を置いて再度コマンドを実行する。考えられる一つの原因としてGitサーバ(Bitbucket)がリソース上限に達している。
当初Gitのクライアントバージョンが1.7.1で、示されている1.6.6以上だったので、バージョンが低いことは疑わずハマってしまいました。
いずれにせよ古いので、ページの内容を鵜呑みにせず、まずはバージョンを上げてみることが必要でしたね。