
https を使用した Git クローンが Mac マシン上で動作せず、次のエラーが発生します。
akshaybandivadekar@Akshays-MacBook-Pro codebase % git clone https://github.com/lodash/lodash.git
Cloning into 'lodash'...
[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.
しかし、sshを使えば動作します
git clone [email protected]:lodash/lodash.git
SSH キーの設定については、このドキュメントを参照しました。 https://docs.github.com/en/authentication/connecting-to-github-with-ssh/新しい ssh キーを生成し、それを ssh エージェントに追加します
答え1
これで問題は解決しました
git config --global url."[email protected]:".insteadOf "https://github.com/"