상황
깃허브 저장소에 수정 권한을 받아 새로운 브랜치를 만들어 수정하고 add / commit 후 push를 하려고 하니 오류가 났다.
참고) [git] Github 협업하기1 (tistory.com)
👀❓에러 메시지
fatal: unable to access 'https://github.com/Play-Web-miniProject/recommend_movie.git/': The requested URL returned error: 403PS C:\web_project\recommend_movie> git push origin2 main remote: Permission to Play-Web-miniProject/recommend_movie.git denied to 5dora. fatal: unable to access 'https://github.com/Play-Web-miniProject/recommend_movie.git/': The requested URL returned error: 403
💡 새로운 변수명으로 git remote add 시도
폴더를 다 삭제하고 origin대신 변수명을 바꿔
💡 제어판 - 사용자 계정 - 자격 증명 관리자 - windows 자격 증명 관리
git.com
아이디 확인
비밀번호 변경
💡 ssh
key-gen
$ ls -al ~/.ssh
$ cat ~/.ssh/id_rsa.pub
PS C:\web_git\recommend_movies> git push origin osy
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Play-Web-miniProject/recommend_movies.git/'
PS C:\web_git\recommend_movies> git config --system --unset credential.helper
error: could not lock config file C:/Program Files/Git/etc/gitconfig: Permission denied
PS C:\web_git\recommend_movies> git push origin osy
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
브랜치를 만들고
git push 명령어를 입력했다.
👀❓ 새로운 에러 메시지
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently
recommended modes of authentication.
fatal: Authentication failed for '저장소 주소'
원인
깃허브 인증에 오류가 났다.
계정 정보의 불일치로 인해 인증이 실패...
주요 발생 원인은 아래와 같다.
- 온라인 상의 github에서 비밀번호를 수정한 후 로컬 git에 저장된 인증정보를 수정하지 않은 경우
- 처음 로컬 git에 인증정보 저장 시 ID/PW를 잘못 기입했을 경우
- 다른 저장소에서 사용하려는 config된 계정 정보가 현재 저장소에서 사용될 경우(git config space혼동)
💡 계정 정보 초기화
// 1.local에서 unset
git config --local --unset credential.helper
// 2.global에서 unset
git config --global --unset credential.helper
// 3.system에서 unset
git config --system --unset credential.helper
이 때 Git의 config에서 계정 인증 정보는 local, global, system의 범위로 저장할 수 있다.
- local: 특정 저장소
- global: 시스템의 특정 사용자
- system: 시스템의 모든 사용자와 모든 저장소
보통은 global 범위인 2번에서 리셋을 진행하면 해결된다. 현재 저장소의 정보를 단순히 잘못 입력했다면 1번으로 충분하고, global에 config를 저장할 때 잘못 기입했거나 github에서 수정됐다면 2번을 사용해야 한다.
3번의 system unset을 하게 되면 무조건 문제가 해결되겠지만, 당연하게도 모든 사용자/저장소의 캐시도 삭제되기 때문에 이후 과거 인증 절차를 지난 모든 프로젝트에서 다시 번거롭게 인증을 진행해야 한다.
따라서 적용 범위를 잘 골라서 캐시를 리셋하는 것이 좋다.
다시 푸시를 하게 되면 로그인창
자격증명이랑 같으면 로그인
'ect > git' 카테고리의 다른 글
[git] Gi&GitHub 실습 (0) | 2024.05.10 |
---|---|
[git] Reset 방법 (0) | 2023.03.23 |
[git] Github 협업하기1 (0) | 2023.03.10 |
[git] github 이론 강의2 (0) | 2023.02.11 |
[git] git 이론 강의1 (0) | 2023.02.11 |