Vagrant w/ windows as host, files don´t run on vm due to crlf

前端 未结 2 1350
[愿得一人]
[愿得一人] 2021-01-07 00:57

I´m trying to set up vagrant with windows as host and ubuntu as guest.

I want to commint vagrant file itself to the repo so the steps would be, clone repo in windows

2条回答
  •  清酒与你
    2021-01-07 01:34

    I would no recommend core.autocrlf to be set to anything else than 'false':

    git config --global core.autocrlf false
    

    It is a repository-wide setting, which will apply to all files, including binary ones. As I explain in "Trying to commit Git files but getting: fatal: LF would be replaced by CRLF in ", it can corrupt those.

    If, for a certain type of files, you need to make sure of the EOL used in them, se a .gitattributes file in which you declare a core.eol directive.

    To control what line ending style is used in the working directory, use the eol attribute for a single file and the core.eol configuration variable for all text files.

    # Declare files that will always have CRLF line endings on checkout.
    *.css text eol=lf
    *.html text eol=lf
    *.js text eol=lf
    

    (see this codewall example, by Scott Grogan (ninjascribble))

提交回复
热议问题