삽질
[Sourcetree & GitHub] 원격 저장소 push중 발생(protected branch hook declined) 이슈
thetortoise
2023. 1. 14. 12:09
발생 이슈: 소스트리에서 GitHub저장소 master branch에 push작업중 [remote rejected] master -> master (protected branch hook declined) 에러 발생
작업 환경: mac os, sourcetree
발생 원인: 깃헙에서 저장소에 protect this branche 설정하면 master branch에 push하는것을 제한하게 됩니다.
진행 과정
- 깃헙 저장소를 생성하면서 protect this branche를 설정
- 로컬 master branch에서 원격지의 master branch로 push함
[remote rejected] master -> master (protected branch hook declined) 에러 발생하며 push작업 실패
해결 방법
- 깃헙 저장소의 protect this branche 설정을 제거한다.
- 깃헙 저장소의 protect this branche 설정에서 master branch 접근 권한을 변경한다.
- master branch가 아닌 새로운 작업 branch를 사용하여 작업하고 master branch 접근 권한자에서 요청한다.
혼자 작업한다면 master branch에 직접 작업을 해도 문제 되지 않지만 협업을 한다면 new branch를 생성하여 커밋하고 합병(merge)한 뒤 master branch에 반영하는것이 좋을 것 같습니다.