Merging Git LFS repository failing due to local changes
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Server* 製品のサポートは 2024 年 2 月 15 日をもって終了します。Server 製品を利用している場合は、Atlassian Server のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
問題
When using repositories with Git Large File Storage (LFS) and a merging scheme such as Gatekeeper, the merge fails with the following error in the build log:
Merge command error: com.atlassian.bamboo.plugins.git.GitCommandException: command /path/to/bin/git merge --no-commit <hash> failed with code 128. Working directory was [<bamboo-home>/xml-data/build-dir/serverSide/<job-key>/mergeWorkspace]., stderr:
error: Your local changes to the following files would be overwritten by merge:
<list of files>
Please commit your changes or stash them before you merge.
Aborting
診断
Diagnostic Steps
- Run
git config -l
in the repository directoryIf the following is not included in the output, you may be affected by this issue:
filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true
原因
This issue is caused by Git LFS not being initialized on the system by the user running Bamboo. This is because Git LFS will add a pointer to each file, which will be seen as an update to non-LFS repositories.
ソリューション
Please run git lfs install
in a Git repository as the Bamboo user. This will initialize Git LFS for all repositories on your system.
This configuration is per user, so if you have previously run git lfs install
as another user, you do still need to run it as the Bamboo user.
Note: If you only want to initialize Git LFS for one repository, you can do this by running git lfs install --local
in the repository where you would like to use Git LFS.
参考