Troubleshooting¶
Windows¶
Problems with line breaks; bash scripts are not running¶
- Error-Messages
- something like
cannot find env bash\r
- something like
- the MaSyMoS-Repositories use the Unix-Way of writing line breaks and UTF-8 encoding
Note
Differences Unix/Windows line-breaks
- Unix-Systems use the line-feed (LF,
\n
) as line-break-character - Windows uses the carriage-return AND line-feed (CRLF,
\r\n
) as line-break-characters (like an old typewriter)
Note
Ways to deal with the differences
configure your git that way, that…
- on checkout, all LF will become CRLF
- on push, all CRLF will become LF
- ⚠ this may lead to unexpected behaviour, especially with bash-scripts!
check out repositories without changes and only use editors, that preserve the Unix-line-breaks, like Notepad++, Atom, IntelliJ or Eclipse (you may need to configure it in some cases)
Note
Ways to deal with the differences
- if you've build the docker image with the 'wrong' line endings, make sure, to build it again using the
rebuild
parameter
Solution¶
- you have to preserve the LF, please do not use CRLF - do not use Windows Notepad…; this means:
core.autocrlf=input
core.safecrlf=true
- if you are just using git
- edit the setting
core.autocrlf=input
, you can set it globally or per repository - options
true
will change LF to CRLF on checkout and CRLF to LF on pushfalse
will do nothing with the line endingsinput
will preserver LF on checkout and on push
- git documentation on AutoCrLf
- check setting for current repository:
git config --list
- if the setting is not existing, the default value is used
- check setting for current repository:
- set setting for current repository:
git config --add core.autocrlf input
- edit the setting
- please check, that
core.safecrlf=true
, you can set it globally or per repository - options
true
this setting will check your files before a commit, if the operation is reversible; about on problemswarn
this setting will check your files before a commit, if the operation is reversible; warn on problemsfalse
this setting will NOT check your files before a commit; do not use this
- documentation on SafeCrLf
- check setting for current repository:
git config --list
- if the setting is not existing, the default value is used
- check setting for current repository:
- set setting for current repository:
git config --add core.safecrlf true
- please check, that
- if you use TortoiseGit
- During installation on a Windows System the software asks how to handle Unix/Windows line-breaks. Default is "checkout windows style" and "check in Unix style". This causes trouble when running shell scripts on windows.
- If you want to change the behaviour for a specific repository do the following:
- clone/create the desired repository
- right click on the directory, TortoiseGit -> Settings
- in the upcomming window click on Git (left)
- change "Config Source" to local
- change "AutoCrLf" to input
- change "SafeCrLf" to true
- delete all files in the directory except ".git" (this directory may be hidden)
- right click on the now empty directory, TortoiseGit -> Revert
- files are pulled again, containing only Unix line-breaks