본문 바로가기
git

Git 메시지에 관한 글

by zkzk7290 2025. 3. 21.
반응형
! [rejected] main -> main (non-fast-forward)error: failed to push some refs to 'https://github.com/sungchanyoung/security.git'hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. If you want to integrate the remote changes,hint: use 'git pull' before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details

(fast-forward) : fast-foward는 merge방식 하나이다.  => 현재 브랜치의 HEAD가 대상 브랜치의 HEAD 까지 옮기는 merge이다.

behindhint : behind(뒤) hint 힌트  => 백엔드 

integrate: 통합하다

counterpart :정부, 부분

remote : 멀리 떨어지

 => 결과적으로 이 메세지는 main브랜치가 현재 로컬 브랜치보다 더 최신 상태이기 때문에 push가 거부되었다는 메시지 

 

해결 방법

//main브랜치를 동기화 시켜주는 작업  
git pull origin main(master) --rebase
최신 변경 사항을 가져오면서 내 변경 사항을 최신 커밋으로 올림

 

//동기화를 마치고 다시 푸쉬해서 최신 상태를 다시 업데이트 
git push origin main(master) 

git push 안될 경우 --force를 main옆에 작성하면 된다. 
--force 강제로
반응형