잿꽃's posting Garden

Git 오류 : failed to push some refs to '',Updates were rejected because the remote contains work that you do 본문

WEB/GIT

Git 오류 : failed to push some refs to '',Updates were rejected because the remote contains work that you do

잿꽃 2022. 4. 22. 14:45

내가 보려고 만드는 git 오류 리스트

 

 

 

Git 오류 :  failed to push some refs to '',Updates were rejected because the remote contains work that you do

 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/ssoa1111/portfolio.git'
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.

위의 같은 내용임

어떻게 매일 git 오류가 날 수 있는지 궁금하지만 해결방법을 찾기 위해 검색을 해보았다.

 

git push -f origin main

이걸 써 주면 된다.

(아래까지 읽고 실행할 것)

 

리드미를 추가해서 난 오류라는데 마침 깃 사이트에 리드미를 추가했었다.

 

[주의]리드미를 깃 사이트에 썼더니 파일은 push가 되었는데 readme가 날라갔다[주의]

깃 사이트에 직접 readme를 작성하였을 경우 위의 push전에 pull과정을 거쳐야 합니다.

로컬 파일에 작성했을 경우 위의 코드를 바로 작성해주면 된다.

 

 

결국 push는 되었지만 공들인 나의 리드미는 날라갔고....흑흑

push한 내용을 만든 시간이 리드미에 쓴 시간의 반의 반도 안되는데....

웬만하면 로컬에 써야겠다는 생각이 들었다...

 

728x90
Comments