본문 바로가기
Development/Git

[Git] 'pre-receive hook declined' 에러 해결

by 성딱이 2023. 4. 3.
반응형

Gitlab 레포지토리 생성 후 기존의 소스코드를 Push하려는데, 다음과 같이 'pre-receive hook declined' 에러가 발생.

JUHYEON@JHJH MINGW64 ~/Desktop/jh/react_edu/react-complete-guide (main)
$ git push -uf origin main
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 12 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (38/38), 166.08 KiB | 6.92 MiB/s, done.
Total 38 (delta 1), reused 0 (delta 0), pack-reused 0
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
To https://gitlab.com/xxxxxx/jh_react.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/xxxxxx/jh_react.git'

 

해당 게시글 참고 후 원인이 권한 문제인 것을 파악 함. (좀 더 자세하게 업데이트) 

 

 

권한 설정 이후 다시 실행해보니

JUHYEON@JHJH MINGW64 ~/Desktop/jh/react_edu/react-complete-guide (main)
$ git push -uf origin main
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 12 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (38/38), 166.08 KiB | 6.92 MiB/s, done.
Total 38 (delta 1), reused 0 (delta 0), pack-reused 0
To https://gitlab.com/xxxxxx/jh_react.git
 + b36c941...c5f3cf4 main -> main (forced update)
Branch 'main' set up to track remote branch 'main' from 'origin'.

정상적으로 Push가 되는구나! 

 

반응형

댓글