github への接続がエラーになっていた話


何が起こったのか

brew updateや、curl なんたらというときに、https:github.comへ接続をかけた際に、エラーになるお話。
調べても全然出てこない!気がしました。。
★SSHのお話ではありません。

エラー内容

なにかのコマンドでgithubからファイル等を取得してくる際には、必ずcurl: (60) SSL〜というエラーになってました。
以下にエラーを。

$ curl -L -I github.com
HTTP/1.1 301 Moved Permanently
Content-length: 0
Location: https://github.com/

curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
$ brew update
fatal: unable to access 'https://github.com/Homebrew/brew/': error setting certificate verify locations:
  CAfile: /etc/ssl/cert.pem
  CApath: none
・
・
省略

やったこと

これが正しいのかはわかりませんので、自己責任・自己判断でお願いします!
自分の場合は、/etc/ssl/cert.pemファイルの中身が空になってました。

$ cd /etc/ssl 
$ sudo wget http://curl.haxx.se/ca/cacert.pem
$ sudo mv cert.pem cert.pem.back
$ sudo mv cacert.pem cert.pem

一応元々のファイルは、[cert.pem.back]でファイル保存をしておきました。
http://curl.haxx.se/ca/cacert.pem ここから、ファイルを保存。
保存ファイルの名前を変更。

ファイル名で指定されているかもしれないので、同一ファイル名にしました。
もしかしたら、*.pemで指定されてるかもしれないので、そこはわかりません。

感想

「...まぢクソ程ハマったべや・・・」 というのが本音。
本気でハマったので、誰かが同じエラー発生の場合これで早期解決を祈っております。

本当にSSL関連の理解が乏しいことを実感させられた1日でした。