When a file has been created on a different system from the one you are using, some cariage returns characters cause problems when commiting to git. You can fix this problem by running one of the following commands, depending on your system.
sed -e 's/$/\r/' inputfile > outputfile # UNIX to DOS (adding CRs)
sed -e 's/\r$//' inputfile > outputfile # DOS to UNIX (removing CRs)
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile # Convert to DOS
perl -pe 's/\r\n|\n|\r/\n/g' inputfile > outputfile # Convert to UNIX (Mac OS X)
perl -pe 's/\r\n|\n|\r/\r/g' inputfile > outputfile # Convert to old Mac