git push -u origin main の実行でエラー
Winodows 1p Pro (64bit)
Vagrant 2.2.14
Ubuntu 16.04.6 LTS
Docker 18.09.7
ruby:ruby 2.7.2p137
GitHubにファイルをプッシュしたら以下のエラーが発生。
git push -u origin main
`````
Warning: Permanently added the RSA host key for IP address '52.69.186.44' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
そこで、以下のコマンドを実行した。
````
root@vagrant:/home/vagrant/rails_docker# sudo ls -al ~/.ssh
total 20
drwx------ 2 root root 4096 Jan 27 08:30 .
drwx------ 8 root root 4096 Jan 27 07:13 ..
-rw------- 1 root root 1679 Jan 26 13:27 id_rsa
-rw-r--r-- 1 root root 394 Jan 26 13:27 id_rsa.pub
-rw-r--r-- 1 root root 1768 Jan 27 08:34 known_hosts
.sshに実行権限を与えた。
````
root@vagrant:/home/vagrant/rails_docker# sudo chmod 700 ~/.ssh
そして再度 git push -u origin mainを実行
````
root@vagrant:/home/vagrant/rails_docker# git push -u origin main
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
エラーが変わった。
ググって
gitでPlease make sure you have the correct access rights and the repository exists. が出た時の対処法
という記事を発見。これを参考にして再度、プッシュして成功しました。
Author And Source
この問題について(git push -u origin main の実行でエラー), 我々は、より多くの情報をここで見つけました https://qiita.com/saito-h/items/d140af3f3dd1f04c13f4著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .