- Home /
.gitattributes file, Unity, Sourcetree and Windows
Hi all
I'm switching to git from mercurial for my Unity version control.
I've setup my Unity project to handle metafiles and force text. I've initialised my git repo I've added a .gitignore file and a .gitattributes file to my root directory. I've set my global settings for CRLF for Windows to be true using
git config --global core.autocrlf true
I can make an initial commit but any commit after this produces this error
What step am I missing?
Here is my .gitattributes file, from github
# 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.
*.c text
*.h 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
Answer by arumiat · Sep 24, 2014 at 01:21 AM
With some help from a good friend and the deletion of the config.core safecrlf in the .gitconfig file, this issue is now resolved!
"some help"? Is the deletion in the file all that was done to resolve the issue?
Yes it was, as best it was explained. Obviously create a system restore or backup before trying
Answer by Slev · Sep 23, 2014 at 12:50 PM
As long as you see the files on github/your preferred repo host, it's fine. Windows and Linux use different characters to ends lines. Windows uses CRLF which is Carriage Return Line Feed, where as Linux uses LF. It shouldn't be too important in the scheme of things. Mono usually asks me if I want to convert lines endings when I switch between my systems.
Thanks Slev
Problem is Sourcetree won't even let me stage those files
git -c diff.mnemonicprefix=false -c core.quotepath=false add -f -- Assets/TestCommit.cs Assets/TestCommit.cs.meta
fatal: LF would be replaced by CRLF in Assets/TestCommit.cs
Completed with errors, see above.
It just freezes up and I have to close it down.
No luck using git bash either