Permission denied (publickey)-Github

素人がgithubへのgit pushでまんまとつまづいた。

ちなみにタイトルのエラーはgithubリポジトリ名を作成後に公開鍵をセットアップする画面に出ていたcreate a new repository on the command line欄のコマンドをターミナルでコピペして実行したら発生した。

 

以下、git push〜をターミナルで実行した結果。

$ git push -u origin master

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

 

その後、下記リンク(公式ドキュメント)を参考に公開鍵を作成、githubに公開鍵を登録した。

Generating SSH keys - User Documentation

 

登録後、接続テストをしてみると・・・

$ ssh -T git@github.com

Hi ****! You've successfully authenticated, but GitHub does not provide shell access.

 上手くいったようだ。インターネットって便利だな。感謝、感謝

 結論:そもそも公開鍵がなかったから作りましょうねってことだった。

<参考ページ>

rochefort.hatenablog.com

 

Generating SSH keys - User Documentation