Software⏱️ 2 min read📅 2026-05-31

How to Fix: Git push error: Unable to unlink old (Permission denied)

Git push error due to permission denied on unlinking old files.

Quick Answer: Check the post-receive hook and ensure it's not trying to delete or modify files that are still being used by other processes, and adjust the permissions accordingly.

The 'Git push error: Unable to unlink old file' issue occurs when the Git server's post-receive hook is unable to remove the old files from the working directory. This can be caused by a permissions issue, where the Git server user or group does not have write access to the repository.

⚠️ Common Causes

  • Insufficient permissions on the Git server or repository.

🛠️ Step-by-Step Verified Fixes

Method 1: Chown the Git Server User

  1. Step 1: Use the `chown` command to set the ownership of the repository to the Git server user. For example, on a Debian-based system, run `sudo chown -R git:git /path/to/your/repo

Method 2: Change Permissions on the Repository

  1. Step 1: Use the `chmod` command to change the permissions of the repository directory. For example, run `sudo chmod -R u+w /path/to/your/repo

💡 Conclusion

By following these steps, you should be able to resolve the 'Git push error: Unable to unlink old file' issue and ensure that your repository is properly updated on the Git server.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions