env: bash\r: No such file or directory [duplicate]

The error message suggests that the script you’re invoking has embedded \r characters, which in turn suggests that it has Windows-style \r\n line endings instead of the \n-only line endings bash expects. As a quick fix, you can remove the \r chars. as follows: sed $’s/\r$//’ ./install.sh > ./install.Unix.sh Note: The $’…’ string is an … Read more

How to force consistent line endings in Git commits with cross-platform compatibility

Q1 Enforcing consistent lineendings Q2 Enforcing at commit as well as checkout (comment) I’ll divide this into 2 parts: Practice and Principle Practice Expansion of code-apprentice’s suggestion Strictly avoid autocrlf — See why autocrlf is always wrong. And here for the core git devs arguing about the ill-thoughtout-ness of autocrlf. Note particularly that the implementor … Read more

How to find out line-endings in a text file?

You can use the file utility to give you an indication of the type of line endings. Unix: $ file testfile1.txt testfile.txt: ASCII text “DOS”: $ file testfile2.txt testfile2.txt: ASCII text, with CRLF line terminators To convert from “DOS” to Unix: $ dos2unix testfile2.txt To convert from Unix to “DOS”: $ unix2dos testfile1.txt Converting an … Read more

git diff – show me line ending changes?

First, make sure you’re using the coloured output (e.g. with git diff –color) and that you’ve enabled whitespace highlighting with (e.g.) git config color.diff.whitespace “red reverse” This might not work in all cases, however, as git doesn’t appear to highlight trailing whitespace for removed lines. To see whitespace that you’ve deleted, simply use git diff … Read more

Is it possible for git-merge to ignore line-ending differences?

Update 2013: More recent git versions authorize using merge with strategy recursive and strategy option (-X): from “Git Merge and Fixing Mixed Spaces and Tabs with two Branches“: git merge -s recursive -Xignore-space-at-eol But using “-Xignore-space-change” is also a possibility Fab-V mentions below: git merge master -s recursive -X renormalize jakub.g also comments that the … Read more