Skip to content

Instantly share code, notes, and snippets.

@siriokun
Forked from megclaypool/The fix.md
Created October 5, 2021 07:27
Show Gist options
  • Save siriokun/734c300f08b39a3f14cf78e7ec3454cf to your computer and use it in GitHub Desktop.
Save siriokun/734c300f08b39a3f14cf78e7ec3454cf to your computer and use it in GitHub Desktop.
["Unable to unlink, Permission denied" Error] Solution for: ``` $ git pull error: unable to unlink old 'sites/default/default.settings.php': Permission denied ```

In this case, the specific error was:

$ git pull
error: unable to unlink old 'sites/default/default.settings.php': Permission denied

I opened the sites directory and saw the following:

$ lll
  rwxr-xr-x  noxlady  staff  160 B    Tue Sep  4 13:34:39 2018  M?    all/
  r-xr-xr-x  noxlady  staff  192 B    Tue Sep  4 13:40:49 2018   ✓    default/
  rw-r--r--  noxlady  staff  904 B    Tue Sep  4 13:34:38 2018   ✓    README.txt
  rw-r--r--  noxlady  staff    2 KiB  Tue Sep  4 13:34:39 2018   ✓    example.sites.php

So I don't have write permissions for the "default" directory...

$ chmod 755 default 

And now I see:

$ lll
  rwxr-xr-x  noxlady  staff  160 B    Tue Sep  4 13:34:39 2018  M?    all/
  rwxr-xr-x  noxlady  staff  192 B    Tue Sep  4 13:40:49 2018   ✓    default/
  rw-r--r--  noxlady  staff  904 B    Tue Sep  4 13:34:38 2018   ✓    README.txt
  rw-r--r--  noxlady  staff    2 KiB  Tue Sep  4 13:34:39 2018   ✓    example.sites.php

Alas, the failed git pull left a whole bunch of clutter in my folder, so I need to git reset --hard HEAD and git clean -f -d to clear out all the changes...

Now I can git pull successfully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment