Mobile 개발

github push error (깃허브 에러) / token 인증

히핑소 2021. 8. 15. 17:52
반응형

github 에 새 repository 를 생성하고, push 했더니 error 가 발생한다.

git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/ompangchu/dateBook.git
git remote -v
git push origin master : 에러 발생

8/13 일 부로 github 에서 push, clone, pull 시 비밀번호 대신 토큰을 사용하게 변경됨.

mac@Machu dateBook % git push origin master

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/ompangchu/dateBook.git/': The requested URL returned error: 403

 

github 의 지침대로, access token 을 받아보자

내 github page 에서 Settings 선택

 

developer settings 선택
personal access tokens - Generate new token

commit 관련 작업을 위해서는 repo 만 선택해도 된다

나머지는 select 하지않고, Generate token

Personal access tokens 를 꼭 따로 저장해둔다

ghp_N................

 

기존의 remote origin 저장소를 삭제하고,

아래 command 대로, 다시 add 하면,

이제 정상적으로 push 가능

mac@Machu dateBook % git remote remove origin

mac@Machu dateBook % git remote add origin https://ghp_xxxxxxxC7YLfxxxxxxx@github.com/ompangchu/dateBook.git

mac@Machu dateBook % git push origin master
Enumerating objects: 112, done.
Counting objects: 100% (112/112), done.
Delta compression using up to 8 threads
Compressing objects: 100% (100/100), done.
Writing objects: 100% (112/112), 2.37 MiB | 1.99 MiB/s, done.
Total 112 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), done.
remote: 
remote: Create a pull request for 'master' on GitHub by visiting:
remote:      https://github.com/ompangchu/dateBook/pull/new/master
remote: 
To https://github.com/ompangchu/dateBook.git
 * [new branch]      master -> master
mac@Machu dateBook %

 

remote add command 는 my access token + @ + git address 를 입력해주면 된다

$ git remote add origin https://"my access token"@github.com/ompangchu/dateBook.git

반응형