본문 바로가기

카테고리 없음

[GIt] The requested URL returned error: 403

!git push
remote: Permission to rotimeh24k/coding-test.git denied to rohhail.
fatal: unable to access 'https://github.com/rotimeh24k/coding-test.git/': The requested URL returned error: 403

 

github 원격 repository에 push를 하였지만 권한 문제로 인한 error가 발생하였다.

이를 해결하기 위해서는 github에서 token을 발급받아 인증을 하면 된다.

 

 

1. generate token

 

1. 깃허브 우측 위 프로필을 클릭하여 Settings 클릭

 

2. 메뉴의 맨 하단 Developer settings 클릭

3. 메뉴의 Tokens 클릭

 

 

4. 우측 상단에 Generate new token 버튼 클릭 후 토큰 생성

 

 

5. 토큰이름 적어주고 repo를 꼭! 클릭하여 토큰을 생성

 

 

2. git remote

 

아래와 같이 원격 저장소와 로컬과 연결해 줄 수 있는데

git remote set-url origin {저장소 주소}

 

기존의 연결의 경우 403 접근권한 error가 발생하여 아래와 같은 형태로 다시 연결을 해주어야 한다.

 

git remote set-url origin https://{닉네임}@github.com/{프로젝트위치}

 

두 코드의 차이를 보면 아래와 같다.

git remote set-url origin https://github.com/rotimeh24k/coding-test.git
git remote set-url origin https://rotimeh24k@github.com/rotimeh24k/coding-test.git

 

VS code에서 진행하면 git remote 후 passward 입력창이 뜨게 되는데 거기에 발급받은 토큰을 입력하면 끝!

 

 

 

Reference