Unsafe repository errors when indexing or viewing a review in Fisheye/Crucible
プラットフォームについて: 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 は除く
要約
Fisheye/Crucible is suddenly unable to run git commands due to a check at the git level. Reviews and indexing are impacted and the following can be seen in the UI and application logs:
com.atlassian.fisheye.dvcs.handler.DvcsProcessException: Error while communicating with VCS: fatal: unsafe repository ('$FISHEYE_INST/var/cache/local_repo/clone' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory
環境
- confirmed on Fisheye 4.8.9 and Linux but likely applies to all supported versions and platforms
診断
confirm the subdirs of FISHEYE_INST and FISHEYE_INSTALLATION are all owned by the same user running the Fisheye application
cd $FISHEYE_INST && find . ! -user <feuser>
原因
If the user is not the same or a different user owns files and/or directories git might complain about an unsafe repo:
Even if the user running Fisheye is root on a Linux Distribution this issue can occur if there are files/dirs owned by another user.
Typically this is the result of Fisheye being first stood up using a dedicated user eg. feuser and then on subsequent start up a different user like root is used.
ソリューション
Ensure the same user running Fisheye/Crucible owns all the files and directories in Fisheye home and installation:
chown -R user:user $FISHEYE_INST
chown -R user:user $FISHEYE_INSTALLATION
chmod -R 755 $FISHEYE_INST
chmod -R 755 $FISHEYE_INSTALLATION
To round everything out we ensure sensible file permissions using chmod