본문 바로가기

기타

[git] github 개인 액세스 토큰 사용 방법

728x90

github 개인 액세스 토큰 사용 방법

비밀번호로 접근 시 에러

Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

$ git push -u origin main
Username for 'https://github.com': admin@sangchul.kr
Password for 'https://admin@sangchul.kr@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: unable to access 'https://github.com/anti1346/filebrowser.git/': The requested URL returned error: 403

https://github.com 로그인 

Profile > Settings

Profile > Settings > Developer settings

Profile > Settings > Developer settings > Personal access toekns > Generate new token

Profile > Settings > Developer settings > New personal access token

액세스 토큰으로 클론 받기

git clone https://<username>:<deploy_token>@gitlab.example.com/username/awesome_project.git

git push -u origin main
Username for 'https://github.com': admin@sangchul.kr
Password for 'https://admin@sangchul.kr@github.com': {deploy_token}

$ git push -u origin main
Username for 'https://github.com': admin@sangchul.kr
Password for 'https://admin@sangchul.kr@github.com': {deploy_token}
오브젝트 나열하는 중: 10, 완료.
오브젝트 개수 세는 중: 100% (10/10), 완료.
Delta compression using up to 8 threads
오브젝트 압축하는 중: 100% (9/9), 완료.
오브젝트 쓰는 중: 100% (10/10), 1.56 KiB | 1.56 MiB/s, 완료.
Total 10 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/anti1346/filebrowser.git
 * [new branch]      main -> main
'main' 브랜치가 리모트의 'main' 브랜치를 ('origin'에서) 따라가도록 설정되었습니다.
728x90