새로운 안드로이드 연습용 프로젝트를 위해 git hub 상에서 repository를 새로 생성하고, git bash로 클로닝 했다.
간단하게 프로젝트 작성 후에, add 해주고 메시지 써서 commit했는데 push가 되지를 않았다.
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/XXXXXX/XXXXXXX.git'
hint: Updates were rejected because the tip of your current branch is
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.
이런 오류였는데, pull을 먼저 해주지 않아서 그런 것 같았다. 빈 repository를 클로닝 해서 바로 사용하면 pull 작업이 필요 없을 거라고 생각했는데 아무래도 그렇지 않은 모양이다.
그래서 아래와 같이 pull 및 리베이스를 해주니 정상적으로 push 명령어가 동작했다.
git pull origin main --rebase
현재 기본 브랜치를 master가 아닌 main으로 사용 중이다.
원래 편하다고 github desktop을 사용해 와서 아직 bash를 쓰다 보면 막히는 부분이 종종 생긴다.
학교에서 유닉스와 운영체제 수업을 듣고 나서부터는 리눅스 CLI를 사용하는 것에는 크게 불편함이 없지만, 기존에 github desktop이 알아서 처리해 주던 부분이 많았던지라 형상 관리 프로시저 자체에는 아직 미숙한 거 같다.
실무에 가기 전까지는 익숙해져야지..