[Mac]fatal: unable to access: The requested URL returned error: 403

pudding·2023년 1월 18일
0

gitlab의 팀 프로젝트 리포로 push를 하려는데 자꾸 권한이 없다는 오류가 나왔다. 리포지토리에서의 role 문제도 아니었고, branch protected 여부도 관련이 없었다 (구글링 하면 대부분 이 두가지에 대해서 나온다)

이전에 gitlab의 개인 프로젝트 레포에는 push가 잘 되었었기 때문에 로그인(계정)문제라고는 생각하지 않았었는데, 하다보니 계정 문제인 것 같았다.

터미널에서 깃 계정을 확인하면 내 깃랩 계정으로 잘 로그인이 되어있었는데 왜때문인지 권한이 자꾸 막혔다. 같이 해결을 도와주시던 분은 맥에서 자체적으로 보안문제로 막는거 같다고도 하셨다.

SSH키로 접속하는 방법도 따라해봤는데 잘 안돼서 다른 방법을 찾고 있었는데 결국은 ssh로 해결 되었다
참고한 글 : https://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http-request-failed

I just got the same problem and just figured out what's cause.
Github seems only supports ssh way to read&write the repo, although https way also displayed 'Read&Write'.
So you need to change your repo config on your PC to ssh way:
1. Edit .git/config file under your repo directory.
2. Find url=entry under section [remote "origin"].
3. Change it from:
url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git
to:
url=ssh://git@github.com/derekerdmann/lunch_call.git
That is, change all the texts before @ symbol to ssh://git
Save config file and quit. now you could use git push origin master to sync your repo on GitHub.

나는
git remote set-url origin ssh://git@github.com/derekerdmann/lunch_call.git
이 명령어로 리모트 주소를 수정해주었더니 push가 잘 되었다. 이것 때문에 하루 종일 구글링만 했는데 해결은 했지만 명쾌하게 원인을 모르겠어서 좀 찝찝하다.

profile
영차 영차 개발 공부 기록 하기

0개의 댓글