[Git] 에러노트_ssh key

hyemi jo·2020년 11월 29일
0

git push를 하는 과정에서

git@gitlab.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 key를 생성하여 gitlab에 새로 등록하는 방법들을 추천해 줘서 해보았지만 똑같은 에러가 계속 발생하였고,

또 구글링을 해보니

새로운 키를 에이전트에 추가
eval “$(ssh-agent -s)”
ssh-add ~/.ssh/id_rsa
출처: https://nickjoit.tistory.com/94 [nickjoIT]

라는 것을 활용해서 새로운 ssh 키를 생성하고 해보았지만 연속되는 실패가 이어졌다.
여기서 더 해지는 상황이 git을 pull 받아보려는 상황에서도 똑같은 상황이 이어져서,
아예 프로젝트를 clone 받아서 하는 방향으로 로직을 틀었다.

하지만.... 클론과정에서도

Cloning into 'highrun-v2'...
no such identity: /Users/summer/.ssh/gitlab_rsa: No such file or directory
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

또 permission denied 상황이 일어나는 것이다.

계속되는 에러에 멘붕이 와서 내가 기업협업에 나간 회사에서 일하고 계신 프론트엔트 분께 질문을 드려서 해결을 할 수 있었다 😭

오랫동안 찾아보다가 해결된 방법은

.ssh/gitlab.rsa: No such file or directory 의 명령어를 보고 캐치하신 것이다. 우리가 생성한 ssh key는 다른 이름의 파일인데 요구하는 것은 다른이름의 파일을 찾고 있어서 그런 상황이었 던 것이다.

  1. 새로운 키를 생성하고
  2. 그 새로운 키의 이름(keyName)을
    ssh-add ~/.ssh/'생성한 keyName' 를 넣어주고

3 . 새로 생성한 ssh키를 gitlab에 등록해 준다.

**참고
https://devlog.jwgo.kr/2019/04/17/ssh-keygen-and-ssh-agent/

profile
기억보단 기록을📓

0개의 댓글