LoginSignup
0
0

More than 3 years have passed since last update.

git push -u origin main の実行でエラー

Posted at

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. が出た時の対処法
という記事を発見。これを参考にして再度、プッシュして成功しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0