Lately, when using a git pull
to update a Drupal project, I’ve been running into this error:
error: unable to unlink old 'sites/default/default.settings.php' (Permission denied)
It’s pretty annoying for a couple reasons. First, it doesn’t update the repo like it should because it gets stuck on that permission error. And second, even though the command fails, it leaves me with a bunch of modified files in my repo.
After a bit of searching, I’ve found the easiest solution on Twitter:
@matthewtift I have a fix! http://t.co/MJfd6xpDjI
— webchick (@webchick) August 29, 2013
Just run this command for the default sites directory to fix the permissions:
chmod ug+w sites/default
Because that failed command left me with a bunch of files, I also usually reset the repo.
git fetch origin
git reset --hard origin/master