Usually this happens because of differences like some platforms or text editing programs work the line terminators.
Linux uses \ n (LF = 1 byte) while Windows by default uses \ r \ n (CRLF = 2 bytes).
You should standardize the termination in your code editor or IDE (if it is a source code file) or configure for git to automatically detect whether or not to handle the line breaks.
Eg how to add settings in local git:
git config --global core.autocrlf true
If you prefer directly in the .gitattributes file:
# Declara arquivos que sempre terão terminadores de linha CRLF no checkout.
*.sln text eol=crlf
# Declara arquivos que sempre terão terminadores de linha LF no checkout.
*.code text eol=lf
See other details here link
On doing this ignore on bitbucket, it seems that there is no way, as there is no option to add this directive.