Unix-style line endings are being converted to windows-style (CRLF) line endings when Git checkout is performed on Bamboo Windows elastic agent
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Unix-style line endings in files are being converted to windows-style (CRLF) line endings when Git checkout is performed on Bamboo Windows elastic agent.
Environment
Windows elastic agent
Git for Windows
Cause
The default value for Git for Windows for core.autoclrf
is true after installation. Bamboo stock elastic images use the default for the Git for Windows installer. This means that when a Git checkout is performed on a Windows machine the LF line endings are converted to CRLF.
Solution
If this is not desirable there are a few options:
Option 1:
Configure a custom Bamboo elastic agent image with core.autoclrf
set to false
globally before snapshotting it:
Option 2:
Set git config --global core.autoclrf false
in a Script task before the source-code checkout on builds that execute on Windows agents.
Option 3:
Add a .gitattributes
to your repository which controls line ending styles and end of line normalization through the text
and eol
attributes:
Was this helpful?