파도가 칠 때는 서핑을

Soon as possible

Wait!

공부/git

[git] git 오류 모음

hyeonhki 2021. 3. 15. 23:10
728x90
hyeonhki@Hyeonhoui-MacBookPro Velog % git push origin master
To https://github.com/kuh7753/Velog.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/kuh7753/Velog.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

- failed to push some refs to ...

👉 이유

  1. 어떠한 경로였든 git 저장소 안의 파일이 변경되었음.
  2. 내가 푸쉬하려고 하는 Desktop안의 폴더는 저장소에서 변경된 사항을 반영하지 못하고 있던 상태였다.

    👉 해결법

  3. 깃 pull을 통해 저장소 안에서 변경된 내용을 받아와서 내가 푸쉬하려는 폴더 안의 내용과 일치시킨다.
  4. push

- 강제 푸쉬 : git push -u origin +master


- Git branch에 main으로 default되면 master에 푸쉬해도 branch로 간다.

728x90