학교프젝 - ElderMate

GitHub 토큰 인증 에러 remote: Support for password authentication was removed on해결방법, remote: Support for password authentication was removed. Please use a personal access token instead. 맥북 git push 아이디 비번 요구, 안될때

나는나는용 2024. 5. 3. 13:13
728x90

문제

Username for 'https://github.com': Ninky0
Password for 'https://Ninky0@github.com': 
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/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/~~~~~~~~

 

git push를 하려하니 아이디 비번을 입력하라는 문구가 나왔다.

 

분명 제대로 깃허브 아이디, 비밀번호를 입력했는데

오류내용을 살펴보니,

push하려는 github repository에 대한 인가가 잘못된모양이다.

 

하여, 내 레파지토리에 대한 토큰을 재발급(연장)하여 password에 입력하니 해결됐다.

 

아래는 해결 과정이다.

 

해결

github 로그인한 뒤 settings 들어가기

Developer settings 들어가기

 

Personal access tokens에서 토큰을 생성(발급)해주던가, 기존 토큰을 연장/업데이트해주자.

 

 

기존 토큰의 업데이트를 위해 토큰 이름을 클릭하거나, 새로운 토큰을 생성하면 다음의 화면이 나온다.

repository에 대한 접근, CLI에서의 레포지토리에 대한 접근을 허용하기위해 repo와 admin:repo_hook을 선택해주었고, 나머지 선택은 내가 필요한거에 맞게 선택하면 된다.

 

이전에는 만료 기한 설정을 안해놨었는데,

무기한이 무기한이 아니었다.

 

그래서 커스텀을 클릭하여 최장기간으로 설정했다.(최대 1년)

 

토큰을 새로 또는 다시 발급받으면

다음의 화면이 나온다.(창 닫지 말자. 나중에 복사한거 붙여넣을거다. )

 

여기서 주의할점은,

꼭 복사!!

 

저 창을 나가면 다시 저 토큰을 볼 수 없다.

큰일은 아니지만 다시 발급받아야 되는 상황이 오기에 귀찮으니까..ㅎ

 

만약 개발 환경이 Mac북이라면,

spotlight 또는 command+spacebar에서 'keychain' / '키체인 접근'을 검색하여 선택해준다.

 

알파벳순서니까 g쯤 가서 github.com을 찾으면 우클릭하여 삭제해준다.

(키체인이 안뜬다면 가볍게 무시하고 다음 단계로)

 

 

맥북 터미널 열어서 다음 코드를 처준다.

git config --global user.name "깃헙아이디"
git config --global user.email "깃헙에설정된@이메일입력"

 

이제다시

원래 git push를 하려던 곳에서 다시 git push를 입력해보면 다음과 비슷하게 나올테다.

 

Username for https://github.com :
Password for https://github.com/xxxx :

 

Username에는  github 아이디,

Password에는 아까 복사했던 토큰

을 입력해준다.

 

평온을 되찾았다.

728x90