본문 바로가기

-

[github] 깃허브 push시 에러 해결 방안

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와 내컴퓨터 사이에 데이터가 일치하지 않아서 생기는 문제라고 한다.

git pull로 수정사항을 합쳐주면 해결 가능하다고 해서 git pull을 했더니 또 다른 에러가 발생했다.

 

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.

 

이 에러는 데이터 유실 등의 문제가 있을 수 있어 에러를 띄우는 것이라고 한다.

git push -u origin +master

근본적인 해결 방안은 아니지만 강제로 푸쉬해주는 명령어를 통해 푸쉬했다 ..........

 


 

git add 시에 또 다른 에러 발생.........

 

warning: CRLF will be replaced by LF in some/file.file.
The file will have its original line endings in your working directory.

 

이 에러는 유닉스 시스템에서는 한 줄의 끝이 LF(Line Feed)로 이루어지는데

윈도우에서는 줄 하나가 CR(Carriage Return)LF(Line Feed)로 이루어지기 때문에

발생하는 에러라고 한다.

 

 Git은 이것을 자동 변환해주는 core.autocrlf 라는 기능을 가지고 있기 때문에 이 기능을 켜주면 해결된다.

 

윈도우

git config --global core.autocrlf true

 

git config --global core.autocrlf true input

 

에러 메세지와 상관 없이 작업하고 싶으면

git config --global core.safecrlf false

 

 

깃허브 에러는 너무 힘들다 ㅠ_ㅠ