스터디/내가 볼라고 만든 오류해결
[Git 오류] remote: Invalid username or password.
FionaisFiona
2024. 9. 24. 10:23
remote: Invalid username or password.
이 오류때문에 몇개 찾아보고 따라해보다가
git push -u origin main 해봤을때,
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
위와 같은 오류가 떠서 다시 푸쉬해봐도
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
이런 생전 첨보는 오류가 떠서 ㅋㅋㅋㅋㅋㅋ 내가 내 닉네임을 애초에 만들때부터 잘못 해서.. 닉네임을 잘 기억하자 되새김
위와 같은 오류가 뜨는이유는 git@github.com 에 연결된 ssh key가 설정되어있지 않기 때문이다.
<해결 방법>
1. ssh 키를 만든다.
터미널에서 아래를 실행한다.
ssh-keygen -t rsa -C “본인 GitHub 계정 이메일”
(1.1) ssh-keygen을 실행하면 terminal 창에 어디 위치에 키를 생성할 건지 지정하라고 나오는데 그냥 엔터키를 누르면 기본 위치(~/.ssh/id_rsa.pub)에 생성된다.
(1.2) 그거 다음엔, 패스워드를 지정하라고 나오는데 하고싶으면 하고 아님 엔터
(1.3) 다음, 이제 ~/.ssh/id_rsa.pub에 키가 생성되었다고 나오는데, 이 키는 나만 알아야함
2. 터미널에서 아래를 실행
cat ~/.ssh/id_rsa.pub
그리고 나온 결과를 메모장에 복사 해둔다.
3. 키를 깃허브에 세팅
Settings -> SSH and GPG Keys -> New SSH key > Title 아무거나 입력 -> Key를 넣는 부분에서 2번에서 복사한 키를 붙여넣기