We observed Ctrl+M character after the BitBucket migration from Perforce almost of the files. Do you have BitBucket-server level options/settings to remove the Ctrl+M chars in all the repository or from each repo/branch? or else Let us know if any other method this can be handled
1 Answers
The canonical way to store text files in Git is with LF endings, even if your project uses other endings, and to convert the line endings on checkout as necessary. It sounds like your repository has CRLF line endings, and a CR character is also Ctrl-M (byte 13).
Servers do not get to modify data on clone because the integrity of data is verified by the hash, and consequently servers cannot change the line endings used.
If you wish to change the line endings for your repo, the easiest way to do that is to create a file called .gitattributes
in the root of your repository with the following content, and then run git add --renormalize .
, and commit that together:
* text=auto
This will result in your files being checked in with LF endings and each user can control which line endings are used on their system. By default, the platform's native line endings are used.
If you have patterns of files, such as shell scripts or PowerShell files, that must always use a given line ending, then you can add lines like this to .gitattributes
:
*.sh eol=lf
*.ps1 eol=crlf
You can read more about these options in the gitattributes
manual page.

- 64,793
- 6
- 84
- 100