(macOS) GitHub commit 하기 by Token (2021.08 이후)

이전 포스트 에서 GitHub commit 방법을 다뤘었다.

MacBook Pro 16 M1도 왔겠다, 오늘 오랜만에 홈페이지 내용 update도 있어 수정 후 push를 하려고 했더니 아래와 같은 오류가 떴다.



중요한 부분은 바로

(base) jihwanmoon@Jihwans-MacBook-Pro-16 ccsl % git push -u origin master

Username for 'https://github.com': (내 계정 email)

Password for 'https://anschino@hotmail.com@github.com': 

remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

fatal: Authentication failed for 'https://github.com/anschino/ccsl/'

더이상 Terminal을 통해 password authentication이 안 된다는 말 같다.

Personal access token (PAT) 이 필요한 것 같아 위에서 알려 준 링크를 타고 내용을 살펴보다가 PAT생성 가이드가 있는 웹페이지를 찾아냈다.


1. PAT 생성
2. Command line으로 git push

1. PAT 생성

일단 위 페이지에서 스크롤을 쭉 내리면 다음과 같은 스텝을 통해 PAT를 생성할 수 있다고 한다.

1) GitHub에 로그인한 후 우측 상단에서 "Settings" 들어가기


2) 좌측 sidebar 맨 밑에서 "Developer settings" 들어가기


3) 좌측에서 "Personal access token" 클릭 후 우측에 "Generate new token" 클릭


4) "Note" 칸에 적당한 token을 대표할 설명/이름을 쓰고 "Expiration" 일수를 선택한 후 밑에 "Selection scope"에서 "repo" 및 하위 수준을 체크

(PAT생성 가이드가 있는 웹페이지에 "Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo."라고 되어 있음) 


5) 밑으로 스크롤을 내린 후 "Generate token" 을 클릭 (Token 코드는 일단 저장해놓자!)


2. Command line으로 git push

위에서 생성한 token을 이용하여 이제 git push를 해보자!

별 건 없고 기존 password 대신 생성된 token을 입력하면 된다.


대충 성공했다는 거임.

Comments