-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug? BashOnWindows appears to convert all files to CRLF on windows volumes #2318
Comments
@cbuschardt - Well... Quote from https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration Formatting and Whitespace
Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the core.autocrlf setting. If you’re on a Windows machine, set it to true – this converts LF endings into CRLF when you check out code:
If you’re on a Linux or Mac system that uses LF line endings, then you don’t want Git to automatically convert them when you check out files; however, if a file with CRLF endings accidentally gets introduced, then you may want Git to fix it. You can tell Git to convert CRLF to LF on commit but not the other way around by setting core.autocrlf to input:
This setup should leave you with CRLF endings in Windows checkouts, but LF endings on Mac and Linux systems and in the repository. If you’re a Windows programmer doing a Windows-only project, then you can turn off this functionality, recording the carriage returns in the repository by setting the config value to false:
|
Also |
@cbuschardt - Thanks for your post. |
It seems to me, as a developer on Windows I will often want my WSL to check out as CRLF so native Windows editors can safely edit. Others might want to configure it differently. But as it was stated, this hurts shell scripts. It would be best if Bash was able to cope with both line ending scenarios, is there a configuration for this? |
Your edit is the standard approach. Cygwin's |
Closing as linux-behavior; people suffer the same general grief with VMs and folder shares. It would be nice if Cygwin's |
It's pretty hard to find a Windows editor these days that will have problems with Unix-style text. The bottom line, adding this to .gitattribute saved me:
|
Microsoft Code has endless problems with this even after setting the default line ending character at application, workspace, and folder level to \n (LF). Running a shell script in Windows/Ubuntu bash windows still throws the \r'' error constantly. |
@ShrykeAbysmal have you solved issue? |
Is this by design? Ideally, we'd have control over this directly.
Some side effects:
The text was updated successfully, but these errors were encountered: