본문 바로가기

PROGRAMMING/GIT

[GITHUB] git@github.com: Permission denied (publickey) 에러

발생한 에러

 

 

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.

 

 

발생 원인이 몇개 될것같긴한데 우선 아래 Github Docs를 참조해보는 것을 추천

 

 

https://docs.github.com/ko/authentication/troubleshooting-ssh/error-permission-denied-publickey

 

오류: 권한이 거부됨(publickey) - GitHub Docs

“사용 권한이 거부됨” 오류는 서버가 연결을 거부했음을 의미합니다. 여러 이유가 있을 수 있으며 가장 일반적인 예시는 아래에 설명되어 있습니다.

docs.github.com

 

 

내 경우에는 ssh key가 아닌 Token생성으로 권한 인증을 하는데 

바보같이 remote시 http가 아니라 ssh로 요청을 하여 해당 오류가 발생했다.

 

 

이 경우 간단하게 remote 해제 후 http로 다시 연결하면 푸쉬가 잘 된다.

 

 

 git remote remove origin

 git remote add origin https://*.git