2012年12月18日火曜日
【GitHub】CentOS5.5でgitHubのリポジトリにpushした時、SSL認証エラー発生
<★現象1>
SSH公開鍵作成、リポジトリ作成して、CentOS5.5の環境から
「git push origin master」しようとすると、SSL認証エラー発生
error: error setting certificate verify locations:
CAfile: /bin/curl-ca-bundle.crt
CApath: none
--------------------
【対応】
(1)CentOSのca-bundle.crt を最新のものに置き換える
$ sudo cp -p /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.bak
$ sudo curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
(2)git config --global で、ca-bundle.crt の参照先を指定する
$ sudo git config --global http.sslcainfo /etc/pki/tls/certs/ca-bundle.crt
(参考)
http://d.hatena.ne.jp/takayuki_goto/20110622/p1
http://www.goodpic.com/mt/archives2/2011/02/github_clonessl.html
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<★現象2>
上記1の対応後、「git push origin master」でgithHubのログイン、パスワード入力すると、
今度はHTTPリクエストエラーが発生
error: The requested URL returned error: 403 while accessing
https://github.com/yadamada/test_yadamada.git/info/refs
fatal: HTTP request failed
--------------------
【対応】
SSHの公開キー未設定の場合は設定する
(参考)
http://yachi-googleblogyachiyo.blogspot.jp/2012/12/githubssh.html
/git/cconfig のurl を、https → ssh に書き換える(httpではなく、SSHで送信するよう設定)
# vi .git/config
(変更前) url = https://github.com/username/test_repojitory.git
(変更後) url = ssh://git@github.com/username/test_repojitory.git
(参考)
http://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http-request-failed
上記(1)(2)の対処を行った後、「git push origin master」 すると、SSHの認証確認になるので
SSHのPassphrase を入力
>>>>>>>>>
Enter passphrase for key '/home/username/.ssh/id_rsa':
Counting objects: 3, done.
Writing objects: 100% (3/3), 215 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://git@github.com/username/test_repojitory.git
* [new branch] master -> master
>>>>>>>>>
→ push 成功!