2016-10-12 14 views
0

내 프로젝트에서 다른 OS를 사용하는 컴퓨터를 사용하는 경우 Mac은 두 번째로 Windows입니다. git을 사용할 때 모든 변경 사항은 전체 문서 변경으로 표시됩니다. 그 이유는이 두 OS에서 서로 다른 end-of-line입니다. 이 https://help.github.com/articles/dealing-with-line-endings/ 읽고 루트 폴더에 .gitattributes 파일을 만들었지 만 문제가 여전히 존재합니다. 내가 전에이 파일의 구성을 많이 시도했기 때문에이 작동하지 왜 아무 생각이.gitattributes가 Mac 및 Windows에서 제대로 작동하지 않습니다.

# Set the default behavior, in case people don't have core.autocrlf set. 
* text=auto 

# Explicitly declare text files you want to always be normalized and converted 
# to native line endings on checkout. 

*.css text 
*.html text 
*.js text 

# Declare files that will always have CRLF line endings on checkout. 
*.sln text eol=crlf 

# Denote all files that are truly binary and should not be modified. 
*.png binary 
*.jpg binary 

: 이것은 내 .gitattributes 파일입니다.

+0

당신이'자식 구성 core.autocrlf' 옵션을 시도 해 봤나보기? AFAIK 이것이 선호됩니다. 문제가 있습니까? – Melebius

+0

예. 두 컴퓨터 모두에서이 작업을 시도하지만 작동하지 않습니다. – MaSza

답변

3

.gitattributes 파일은 첫 번째 커밋과 함께 추가되어야합니다. 몇 개의 커밋을 추가하면 모든 기존 파일을 명시 적으로 정규화해야합니다.

$ rm .git/index  # Remove the index to force Git to 
$ git reset   # re-scan the working directory 
$ git status  # Show files that will be normalized 
$ git add -u 
$ git commit -m "Introduce end-of-line normalization" 

https://git-scm.com/docs/gitattributes