Git Cloneができない😞

新しくPCを環境構築して、Gitの設定してもとのPCのファイルをCloneしようとしたらエラーが出た。。。

原因はsshの鍵を読み込ませていなかったこと

  1. user.name, user.emailをターミナルに入れる

  2. ssh-keygenで鍵作る

  3. Gitに公開鍵を載せる

  4. ssh-add で鍵を読み込ませる⭐️

4が重要!

詳しい状況👇---------------------------------

$git clone git@github.com:AAA/AAA.git
Cloning into 'AAA'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

これができなかった。。。

$ssh-add -l
The agent has no identities.

これだと鍵読み込めていない。

$ssh-add ~/.ssh/AAA
Enter passphrase for AAA:
Identity added: ~/.ssh/AAA

これでcloneできるようになった!


(参考文献)


この記事が気に入ったらサポートをしてみませんか?