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

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, vagrant up and have the env ready and running.

The problem is, since the repo is cloned in windows, all the files have crlf. When these are executed from vagrant ssh, throws error

How can a repo coexist in vagrant with windows as host and linux as guest, so my teammates that use windows can still edit files safely and commit them?

thanks in advance

Answers


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 <some file in repo>", 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))


Found the solution,

for git, set the config like so: git config --global core.autocrlf input

source: http://blog.xjtian.com/post/54399466362/vagrant-tips-for-windows-users


Need Your Help

How can I not send server-side only IDs to the client in the HTML?

html asp.net client-side server-side

I'm working on an .aspx page that doesn't utilise any post backs for certain controls, so I don't need the IDs that are appearing on those controls in the HTML. I do need the IDs server side though...