Github
[Github] Git push 오류 해결 (Updates were rejected because the tip of your current branch is behind)
YOONJELLY
2021. 7. 31. 17:07
github에서 레파지토리를 새로 생성하고 첫 push를 하려는 순간
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/ / .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.
해당 오류를 마주했다.
검색을 해보니
깃허브 레파지토리를 생성할 때 README.md 파일을 함께 생성했기 때문에 발생한 문제 라고 한다.
오류 내용 중 git pull을 해주면 된다하여 실행하였으나
같은 에러가 발생했다.
해당 오류는 데이터 유실 등의 문제 발생에 대해 git에서 처리하지 않도록 에러가 발생하는 것 이라고 한다.
현재 유실될만한 파일이 없었기에 +를 사용하여 강제로 push를 해주는 방법 으로 해결하였다.
$ git push -u origin +master