본문 바로가기

Programming/git

git 이중계정 push 에러 해결 ERROR Permission to xxxxx.git denied to userB

% git push origin main
ERROR: Permission to xxxxx.git denied to userB
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

다중계정을 이용하는 사람은 가끔 번거롭다.

새로운 깃 리포지토리를 등록하려고 할때, remote add에서 ssh로 진행해서인지 계속 위와같은 에러가 나왔다.

MacBookAir xxxxx % git remote set-url origin git@github.com:userA/xxxxx.git

이렇게 ssh로 설정을 해도 안되어서, config파일에 설정해 놓은 대로 

MacBookAir xxxxx % git remote set-url origin git@github.com-userA:userA/xxxxx.git

user A가 있고 user B가 있는데, 회사용은 userB로 사용하고 있었다.

어쨌든, user A의 깃에 올려야했으므로, 이리저리 해보다가 혹시나 하는 마음으로 ssh를 http로 변경해보았다.

 

그렇게 하니까 무사히 업로드완료..ㅋㅋㅋㅋ

약간 허탈하기도 하고, 한번 알아 놓은 방법을 정리해놓지 않으니 이런 불상사가 생겼나 싶기도 하다.

공부한 것, 새로 안 것은 바로바로 정리하기. 잊지말자 :)

'Programming > git' 카테고리의 다른 글

git error Git-Repository not found  (0) 2021.04.16
리모트 브런치 삭제하기  (0) 2021.04.15
git 브랜치 삭제 방법  (0) 2020.08.25