Search code examples
gitgithubnewlineline-endingslf

possible to config Git line-endings specific to repo?


I am working on both Windows and Mac against a repo with origin on GitHub.

On GitHub, I want line-endings to be LF.

On Mac OS X, I want line-endings to be LF.

On Windows, I want line-endings to be CRLF -- except for a specific repo where I want LF.

Is this possible ?


Solution

  • I would suggest that on windows you run

    git config --global core.autocrlf true
    

    which will automatically translate to and from windows line endings

    and then in specific repositories, which don't want conversion, you should run

    git config core.autocrlf false
    

    as you will notice git config has a --global property which modifies your ~/.gitconfig ( or C:\Users\.gitconfig ) file. Without this flag these settings are added to your repository.

    See the git reference manual for a further explanation