Unix-style line endings are being converted to windows-style (CRLF) line endings when Git checkout is performed on Bamboo Windows elastic agent
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
要約
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.
環境
- Windows elastic agent
- Git for Windows
原因
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.
ソリューション
If this is not desirable there are a few options:
オプション 1:
Configure a custom Bamboo elastic agent image with core.autoclrf
set to false
globally before snapshotting it:
- カスタム エラスティック イメージの作成 - Windows
- http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace
オプション 2:
Set git config --global core.autoclrf false
in a Script task before the source-code checkout on builds that execute on Windows agents.
オプション 3:
Add a .gitattributes
to your repository which controls line ending styles and end of line normalization through the text
and eol
attributes: