I am trying to build some code in Linux and I am getting the error:
'\r': command not found
Now I know this question has been asked in general before and I have already read the answers to them. In this question I am asking for a clarification for my particular situation.
In those questions, the reasons for that error has already been explained: The existence of an invisible character that gets interpreted as a command.
One suggested solution has been to modify the files to eliminate those characters. This solution is not feasible in my case for two reasons:
- It is impractical to go and modify all the files involved
- It has been expressly ordered to me that I cannot modify the files.
One solution recommended here and here suggest to modify the EOL behavior in Cygwin by setting an option to ignore CRs:
The problem is that this igncr
option has so few documentation that I couldn't find details on this. Is this option available for linux systems too?
(For reference I am working on a git bash in windows to manage the repository but I build the code after transferring it to a linux workstation inside a docker container)
The other possible solution I found was this one in which it was suggested to modify the git settings in order to configure Git to not convert line endings on checkout:
How does this config works? In the linked answer it says
git config --global core.autocrlf input
when I do git config --list
in my windows machine I get
core.autocrlf=true
Should I change the config and clone my entire repository again??
I am looking for clarifications on these two possible solutions but any other solution (that does not involve modifying the files) is fine too
Just for reference
I git manage locally a repo on a windows machine. Once finished I transfer the code to a remote linux machine and I build the code there. There is where the problem with \r appears