git初学者です。MacBook Air os11.2.3を使用しています。
git pushするとエラーになり下記のメッセージが表示されます。
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
調べたところ秘密鍵をssh-addで追加する必要があるとのことでしたので
下記のようにしたのですが同じようなエラーになってしまいました。
ご教示いただけましたら幸いです。
Last login: Thu Apr 1 17:38:20 on ttys000
***@***noMacBook-Air ~ % ssh-keygen -t ed25519 -C "***@gmail.com"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/***/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/***/.ssh/id_ed25519.
Your public key has been saved in /Users/***/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:MyFrFYsM9jAWPHz7Xyh5ayfA8rvcgHlx2Aeg66dz23s ***@gmail.com
The key's randomart image is:
+--[ED25519 256]--+
| oB. o |
| o+*.o + |
| o*.+ . |
| .= + . |
| +oS.o.. |
| o.o*=o.. |
| +o+= o |
| .=o+= E |
| .o==+= |
+----[SHA256]-----+
***@***noMacBook-Air ~ % eval "$(ssh-agent -s)"
Agent pid 1687
***@***noMacBook-Air ~ % open ~/.ssh/config
The file /Users/***/.ssh/config does not exist.
***@***noMacBook-Air ~ % touch ~/.ssh/config
***@***noMacBook-Air ~ % ssh-add -K ~/.ssh/id_ed25519
Enter passphrase for /Users/***/.ssh/id_ed25519:
Identity added: /Users/***/.ssh/id_ed25519 (***@gmail.com)
***@***noMacBook-Air ~ % cd ~/Documents/udemy_code/git_tutorial
***@***noMacBook-Air git_tutorial % git remote add origin https://github.com/***/git_tutorial.git
fatal: remote origin already exists.
***@***noMacBook-Air git_tutorial % git push -u origin master
Warning: Permanently added the RSA host key for IP address '52.192.72.89' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
***@***noMacBook-Air git_tutorial %