Line Endings in Github for Windows (1 Viewer)

cwchapma

Portal Pro
October 15, 2006
56
34
48
Home Country
Canada Canada
I'm new to github and am attempting to make my first pull request to mediaportal using Github for windows. I forked mediaportal, cloned the fork to my machine, made my changes, and committed the changes locally. At this point, the diffs still looked good. However, when I synced the commit with github, my commits changed to whole file changes even though the majority of the file looks the same. I assume this because of line ending inconsistencies.

Github for windows puts out a warning that mediaportal's line endings aren't normalized. It recommends adding a .gitattributes file that contains

Code:
# Auto detect text files and perform LF normalization
* text=auto
 
# Custom for Visual Studio
*.cs	diff=csharp
*.sln	merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
 
# Standard to msysgit
*.doc	diff=astextplain
*.DOC	diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot  diff=astextplain
*.DOT  diff=astextplain
*.pdf  diff=astextplain
*.PDF	diff=astextplain
*.rtf	diff=astextplain
*.RTF	diff=astextplain

It also wants to go ahead and normalize the line endings in all the files.

Would there be support for this change? Or is there something I'm doing wrong?

Not sure how many people are using github for windows.

Any guidance is appreciated.

Thanks,
Clint
 
Last edited:

cwchapma

Portal Pro
October 15, 2006
56
34
48
Home Country
Canada Canada
Apparently, you need to go to 'Tools' > 'open a shell here' and then use the command:

Code:
git config --global core.autocrlf true

To have Github for Windows handle the line endings properly.

I still think the .gitattributes settings may make it so the command above isn't necessary. Anyone agree or disagree?

Clint
 

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Sounds remarkably similar to a thread I posted on internal team forums ;)

    We are looking at it
     

    Users who are viewing this thread

    Top Bottom