삽질/개발,엔지니어링

github 토큰 기반 인증

maengis 2021. 12. 23. 05:34

https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

 

Token authentication requirements for Git operations | The GitHub Blog

Beginning August 13th, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.

github.blog

 

2021년 8월 15일부터 github 저장소 사용시 비밀번호가 아니라 토큰을 사용하게 변경이 되었다.

로그인 후에 아래 페이지로 이동하여

 

https://github.com/settings/tokens

 

GitHub: Where the world builds software

GitHub is where over 73 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

 

Generate new token 클릭 > Repo 체크(하위 전부 체크됨) > Generate token 클릭

 

생성된 토큰을 사용하면 된다. 토큰마다 유효기간과 권한을 다르게 부여할 수 있다.

 

내 경우에는 PHP라서 그냥 냅다 풀 받고 부어버리는 방식으로 배포를 하고, 일부 디렉토리나 파일 등에 작업을 해주는 쉘스크립트로 배포를 하고 있었는데, 토큰으로 변경되곤 github 계정 / 토큰을 입력하게 돼 버려서 아래 방법으로 해결해주었다.

 

git clone한 곳으로 이동 후

 

sudo git config credential.helper store

 

이후 git pull을 하든 뭐든 git을 사용하면 github 계정 정보를 물어보는데, 이 때 계정과 토큰을 입력하면 그 이후로는 안 물어본다.

반응형