git add throws warning “CRLF will be replaced by LF in ”










4















I started working on a Xamarin crossplatform development recently. While some of devs in my team are using Mac for development (with Visual Studio for Mac), others are using Windows (with Visual Studio 2017). We use git/github as our code repository/version control system.



After I did some changes and added some new files, I issued git add . to stage all my changes but I got warnings like this



warning: CRLF will be replaced by LF in <file-name>.
The file will have its original line endings in your working directory


I checked my git config and core.autocrlf=input which to my understanding and according to documentation here https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, is correct setting for Mac.



However, I am unsure about the warning above since I have never seen it before.
I find it even more confusing since not all of files I added are showing this warning but only some.



I have read numerous posts about this issue but none seam to clearly explain if these warnings can or cannot be ignored. Or if they need to be fixed and how to fix them for teams that use both Windows and MacOS like mine team does.



Do I need to worry about this warning and what does it exactly mean for teams like mine working on both Windows and MacOS machines?










share|improve this question




























    4















    I started working on a Xamarin crossplatform development recently. While some of devs in my team are using Mac for development (with Visual Studio for Mac), others are using Windows (with Visual Studio 2017). We use git/github as our code repository/version control system.



    After I did some changes and added some new files, I issued git add . to stage all my changes but I got warnings like this



    warning: CRLF will be replaced by LF in <file-name>.
    The file will have its original line endings in your working directory


    I checked my git config and core.autocrlf=input which to my understanding and according to documentation here https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, is correct setting for Mac.



    However, I am unsure about the warning above since I have never seen it before.
    I find it even more confusing since not all of files I added are showing this warning but only some.



    I have read numerous posts about this issue but none seam to clearly explain if these warnings can or cannot be ignored. Or if they need to be fixed and how to fix them for teams that use both Windows and MacOS like mine team does.



    Do I need to worry about this warning and what does it exactly mean for teams like mine working on both Windows and MacOS machines?










    share|improve this question


























      4












      4








      4


      2






      I started working on a Xamarin crossplatform development recently. While some of devs in my team are using Mac for development (with Visual Studio for Mac), others are using Windows (with Visual Studio 2017). We use git/github as our code repository/version control system.



      After I did some changes and added some new files, I issued git add . to stage all my changes but I got warnings like this



      warning: CRLF will be replaced by LF in <file-name>.
      The file will have its original line endings in your working directory


      I checked my git config and core.autocrlf=input which to my understanding and according to documentation here https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, is correct setting for Mac.



      However, I am unsure about the warning above since I have never seen it before.
      I find it even more confusing since not all of files I added are showing this warning but only some.



      I have read numerous posts about this issue but none seam to clearly explain if these warnings can or cannot be ignored. Or if they need to be fixed and how to fix them for teams that use both Windows and MacOS like mine team does.



      Do I need to worry about this warning and what does it exactly mean for teams like mine working on both Windows and MacOS machines?










      share|improve this question
















      I started working on a Xamarin crossplatform development recently. While some of devs in my team are using Mac for development (with Visual Studio for Mac), others are using Windows (with Visual Studio 2017). We use git/github as our code repository/version control system.



      After I did some changes and added some new files, I issued git add . to stage all my changes but I got warnings like this



      warning: CRLF will be replaced by LF in <file-name>.
      The file will have its original line endings in your working directory


      I checked my git config and core.autocrlf=input which to my understanding and according to documentation here https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, is correct setting for Mac.



      However, I am unsure about the warning above since I have never seen it before.
      I find it even more confusing since not all of files I added are showing this warning but only some.



      I have read numerous posts about this issue but none seam to clearly explain if these warnings can or cannot be ignored. Or if they need to be fixed and how to fix them for teams that use both Windows and MacOS like mine team does.



      Do I need to worry about this warning and what does it exactly mean for teams like mine working on both Windows and MacOS machines?







      git git-add core.autocrlf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '18 at 18:13







      cd491415

















      asked Nov 13 '18 at 23:28









      cd491415cd491415

      309110




      309110






















          1 Answer
          1






          active

          oldest

          votes


















          2














          I would still recommend:



          git config core.autocrl false
          git add --renormalize .
          git commit -m "Do not touch eol"


          If you can, avoid Git making any change to your eol, and work with editors which respect the eol of the file being edited.






          share|improve this answer























          • Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

            – cd491415
            Nov 14 '18 at 15:56











          • @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

            – VonC
            Nov 14 '18 at 17:38












          • according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

            – cd491415
            Nov 14 '18 at 17:58






          • 1





            @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

            – VonC
            Nov 14 '18 at 20:21











          • @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

            – VonC
            Nov 14 '18 at 20:23










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291011%2fgit-add-throws-warning-crlf-will-be-replaced-by-lf-in-file-name%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          I would still recommend:



          git config core.autocrl false
          git add --renormalize .
          git commit -m "Do not touch eol"


          If you can, avoid Git making any change to your eol, and work with editors which respect the eol of the file being edited.






          share|improve this answer























          • Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

            – cd491415
            Nov 14 '18 at 15:56











          • @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

            – VonC
            Nov 14 '18 at 17:38












          • according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

            – cd491415
            Nov 14 '18 at 17:58






          • 1





            @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

            – VonC
            Nov 14 '18 at 20:21











          • @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

            – VonC
            Nov 14 '18 at 20:23















          2














          I would still recommend:



          git config core.autocrl false
          git add --renormalize .
          git commit -m "Do not touch eol"


          If you can, avoid Git making any change to your eol, and work with editors which respect the eol of the file being edited.






          share|improve this answer























          • Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

            – cd491415
            Nov 14 '18 at 15:56











          • @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

            – VonC
            Nov 14 '18 at 17:38












          • according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

            – cd491415
            Nov 14 '18 at 17:58






          • 1





            @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

            – VonC
            Nov 14 '18 at 20:21











          • @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

            – VonC
            Nov 14 '18 at 20:23













          2












          2








          2







          I would still recommend:



          git config core.autocrl false
          git add --renormalize .
          git commit -m "Do not touch eol"


          If you can, avoid Git making any change to your eol, and work with editors which respect the eol of the file being edited.






          share|improve this answer













          I would still recommend:



          git config core.autocrl false
          git add --renormalize .
          git commit -m "Do not touch eol"


          If you can, avoid Git making any change to your eol, and work with editors which respect the eol of the file being edited.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 6:06









          VonCVonC

          843k29426733227




          843k29426733227












          • Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

            – cd491415
            Nov 14 '18 at 15:56











          • @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

            – VonC
            Nov 14 '18 at 17:38












          • according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

            – cd491415
            Nov 14 '18 at 17:58






          • 1





            @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

            – VonC
            Nov 14 '18 at 20:21











          • @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

            – VonC
            Nov 14 '18 at 20:23

















          • Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

            – cd491415
            Nov 14 '18 at 15:56











          • @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

            – VonC
            Nov 14 '18 at 17:38












          • according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

            – cd491415
            Nov 14 '18 at 17:58






          • 1





            @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

            – VonC
            Nov 14 '18 at 20:21











          • @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

            – VonC
            Nov 14 '18 at 20:23
















          Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

          – cd491415
          Nov 14 '18 at 15:56





          Could you elaborate bit? Why not change if you work on Mac and others are on Windows? etc? Thanks

          – cd491415
          Nov 14 '18 at 15:56













          @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

          – VonC
          Nov 14 '18 at 17:38






          @cd491415 Because both Mac and Windows can work with the same files in n eol (rn is not needed) So no need for Git to touch anything.

          – VonC
          Nov 14 '18 at 17:38














          according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

          – cd491415
          Nov 14 '18 at 17:58





          according to hit documentation git-scm.com/book/en/v2/Customizing-Git-Git-Configuration, you should not use false in cross-platform teams though

          – cd491415
          Nov 14 '18 at 17:58




          1




          1





          @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

          – VonC
          Nov 14 '18 at 20:21





          @cd491415 That doc is old and now not accurate, even obsolete. It doesn't even mention core.safecrlf (git-scm.com/docs/git-config#git-config-coresafecrlf). As I have been saying the past 8 years (stackoverflow.com/a/2016763/6309, stackoverflow.com/a/2825829/6309), eol should be managed through .gitattributes core.eol directive, not the all-encompassing core.autocrlf, which modifies everything.

          – VonC
          Nov 14 '18 at 20:21













          @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

          – VonC
          Nov 14 '18 at 20:23





          @cd491415 I didn't see your edit in your question, but you are referencing an obsolete documentation.

          – VonC
          Nov 14 '18 at 20:23



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291011%2fgit-add-throws-warning-crlf-will-be-replaced-by-lf-in-file-name%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo