After the git version upgrade, Bitbucket Server shows the "CRLF will be replaced by LF" error during the commit in Bitbucket UI.
プラットフォームについて: サーバーと Data Center のみ。この記事は、サーバーおよび Data Center プラットフォームのアトラシアン製品にのみ適用されます。
要約
After the git version upgrade on Bitbucket Server, when a user performs a commit in any file from Bitbucket UI - the popup shows "CRLF will be replaced by LF" and "bogus format in GIT_CONFIG_PARAMETERS " errors.
環境
Bitbucket 7.21.4, It applies to most of the Bitbucket Server versions
Git 2.35.7, It applies to other git versions
診断
2023-03-07 02:09:25,268 DEBUG [http-nio-7990-exec-7] p565337 *1GA9PHOx129x691390x0 b6da7i 10.36.84.189,10.149.63.10 "PUT /rest/api/latest/projects/DEV/repos/java-test-project/browse/pom.xml HTTP/1.1" c.a.bitbucket.dmz.process.NioProcess 11345: [/localapp/tools/git/bin/git -c core.autocrlf=input -c core.safecrlf=warn -c core.symlinks=false commit -m Adding space to test crucible +review DOP @p855933 -q --no-verify -- pom.xml] exited 0 in 26ms (stdin: 0, stdout: 0, stderr: 328)
2023-03-07 02:09:25,271 DEBUG [http-nio-7990-exec-7] p565337 *1GA9PHOx129x691390x0 b6da7i 10.36.84.189,10.149.63.10 "PUT /rest/api/latest/projects/DEV/repos/java-test-project/browse/pom.xml HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500
com.atlassian.bitbucket.scm.CommandFailedException: '/localapp/tools/git/bin/git -c core.autocrlf=input -c core.safecrlf=warn -c core.symlinks=false commit -m Adding space to test crucible +review DOP @p855933 -q --no-verify -- pom.xml' exited with code 0 saying: warning: CRLF will be replaced by LF in pom.xml.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in pom.xml.
The file will have its original line endings in your working directory
error: format in GIT_CONFIG_PARAMETERS
fatal: unable to parse command-line config
原因
The errors "CRLF will be replaced by LF" and "bogus format in GIT_CONFIG_PARAMETERS " is a result of an incorrect upgrade of the git version. When the steps are not followed properly, it leads to a failed commit in the Bitbucket user interface.
ソリューション
To upgrade git on Bitbucket Server, the below steps should be followed which allow the new version of git to be compiled and installed on Bitbucket Server. Once done, a new version of Git needs to be utilized by using plugin.bitbucket-git.path.executable parameter by passing the complete path of the new git version directory within the bitbucket.properties file, available in <Bitbucket_Home>/shared path. These steps are advised by git itself.
Step1: Install tar file for required git version.
Step2: tar -zxf <git version tar file>
Example: tar -zxf git-2.8.0.tar.gz
Step3: cd <git_extracted_directory_from_tar>
Example: cd git-2.8.0
Step4: make configure
Step5: ./configure --prefix=/usr
Step6: make all doc info
Step7: sudo make install install-doc install-html install-info