error: unable to write file git/objects/

 git pull
error: unable to write file .git/objects/18/682e3bc1d8d896a6269e7ed6dc4797aa53435f: Permission denied
fatal: failed to write object
fatal: unpack-objects failed

Try to run the following commands to see if they resolve the problem:

  • Stop Bitbucket Server
  • Copy the $BITBUCKET_HOME/shared/data/repositories/<repository_id> folder. This is to make sure that a backup of the entire repository is available.
  • Run the following commands from the $BITBUCKET_HOME/shared/data/repositories/<repository_id> path:

    git fsck --no-danglinggit repack -adfln --keep-unreachable --depth=20 --window=200
  • Start Bitbucket Server

If the steps above don't resolve the problem, the repository may be not recoverable. In this case, the situation can be resolved by restoring a backup generated prior to the corruption.

Share :

error: unable to write file git/objects/