development/github

[github] github push 실패😭 fatal: unable to access 'repository' : The requested URL returned error: 403

susu2 2021. 7. 28. 19:35

 

수업을 듣다가 한 파트가 끝날 때마다 github에 push를 해주고 있다.

오늘도 룰루랄라 add -> commit -> push... 를 하는데

????

remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'repository': The requested URL returned error: 403

상기와 같은 에러가 뜨고 push가 되지 않았다.

 

해당 에러를 겪은 개발자들은 3가지 정도 해결방법을 알려주고 있었는데,

1. 키체인에서 github 정보를 수정하는 방법

 --> 비밀번호 입력창까진 나왔는데, 똑같은 에러가 발생했다.

2. git remote set-url origin 명령어를 통해 github repository를 다시 설정해주는 방법

 --> 역시 실패.

 

마지막 방법으로 github token을 생성해서 비밀번호 대신 token을 이용하는 방법.

(제일 번거로워 보여서 마지막 방법으로 넘겼는데... 매우 쉽다. 그냥 처음부터 이 방법으로 할걸)

 

 

자 그래서!! 에러 해결을 위해 우선은 github에서 token을 생성해봅시다.

 

1. 터미널에서 아래의 명령어를 사용하여 이전 자격 증명을 삭제

윈도우: git credential-manager reject https://github.com
Mac: git credential-osxkeychain erase https://github.com

 

 

2. github 로그인

https://github.com/

 

GitHub: Where the world builds software

GitHub is where over 65 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and feat...

github.com

 

 

3. 우측 상단 프로필 사진 클릭 --> Settings 클릭

 

4. 좌측 사이드 메뉴의 Developer settings 클릭

 

5. 좌측 사이드 메뉴의 Personal access tokens 클릭

 

6. Generate new token 버튼 클릭 

Note에 생성할 토큰의 이름,

Select scopes에서 부여할 권한을 체크해서 Generate token을 클릭하자.

 

 

7. token 생성 완료!

주의 할 점은 생성된 토큰은 다시 볼 수 없기 때문에, 해당 토큰을 복사 후 본인만 알 수 있는 곳에 저장해 놓아야한다.

 

 

다음으로 터미널에서 아래의 명령어를 입력한다.

git remote set-url origin https://{token}@github.com/{git_repository_url}

{token}에 생성한 토큰 값을,

{git_repository_url}에 본인의 git repository url을 입력하면 된다.

 

그 후 push하면 정상적으로 작동하는 것을 볼 수 있다.

끝!