Add the following to your .gitattributes file from your terminal
echo "* text=auto" >>.gitattributes
install dos2unix in your macOS
brew install dos2unix
if you don’t have brew in your mac you can visit this article Install Homebrew · Mac
on current project directory that has this issue execute this command:
find . -type f -print0 | xargs -0 dos2unix