
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

새 윈도우 컴퓨터에 기존 작업하던 레포지토리를 clone해오려다가 위와 같은 에러가 발생했다.
전에 하다가 방치해뒀던 프로젝트 다시 손 봐보려니 처음부터 난관이..🥲
찾아보니 git push나 git pull 명령어 시도했을 때 이 에러를 겪는 경우가 있다고 한다.
해당 git@github.com에 연결된 ssh key가 설정되어 있지 않기 때문
ssh key를 만들고 본인의 github계정에 등록해주기!
ssh-keygen -t rsa -C “본인 GitHub 계정 이메일”
Enter file in which to save the key (/c/Users/OOO/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:이렇게 하면 ~/.ssh/id_rsa.pub에 키가 생성되었다고 나오는데, 이 키는 절대 남에게 공개하면 안 된다!
이제 생성된 키를 Github에 등록해야!
cat ~/.ssh/id_rsa.pub 해서 나온 내용 복사
Github 로그인 - Settings - SSH and GPG Keys

New SSH key - Title 입력 - Key 입력란에 복사해둔 ssh key(~/.ssh/id_rsa.pub) 넣기

이렇게 한 후 다시 git clone 시도해보니 에러가 해결되었다.
