git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-upstream ~~~ main:main
Pushing to https://github.com/~~~/***
To https://github.com/~~~/***
jected] main -> main (fetch first)
error: failed to push some refs to 'https://github.com/~~~/***'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
오류가 나면서 완료됨.
이는 원격저장소(github)에 로컬(내 컴퓨터)에는 없는 파일이 있을 때, 내 파일을 push 하면 발생하는 오류이다.
이럴땐 원격저장소에서 내 로컬에 저장하지 않은 파일을 pull한 후 원격저장소에 다시 push를 해야한다.
💡
깃허브에 레포지토리를 만들 때 readme.md를 생성했더니 그 파일 때문에 원격 repo와 로컬 repo의 상태(?)가 달라서 그랬지 않을까 추측…
기존 레포지토리 지우고, 리드미 파일 만들지 않은 쌩 repo를 다시 만들어서 그걸 다시 소스트리 local에 원격 repo로 연결했더니 이상 없이 push 됐다…