기타/GitHub
[Git오류] Updates were rejected because the remote contains work that you do: git pull로 해결
하루살이
2022. 4. 5. 16:22

원인
레포지토리를 README 파일이나 LICENSE파일과 같이 생성하면 발생함
나는 이미 커밋된 내용에서 추가/삭제된 내용이 아닌 새롭게 다른 파일로 변경했을 때 주로 발생했음.
해결
git remote add origin 레포url // 다시 레포 연결
(git pull --rebase // git pull이 바로 안될 때 )
git pull origin master // git pull
git push origin master // 다시 push하기