Git remote: error- 'remote:error: unable to unlink old 'filename_here' (permission denied)' after git push

11,928

From your description, it looks like you're pushing into a remote repository that is set up to check out the files to a local working directory and the permissions in that directory don't allow the checkout. If that is the case, a well-placed chmod command should do the trick (something like chmod -R u+w * run with the user credentials)

Share:
11,928
badcrocodile
Author by

badcrocodile

Updated on June 05, 2022

Comments

  • badcrocodile
    badcrocodile almost 2 years

    For about 2 weeks now whenever I did a git push I would get about 200 errors reading this- remote:error: unable to unlink old 'wp-plugins/foobar.php' (Permission denied). But I could still push files to the server- just not any files in the wp-plugins directory.

    Today after doing some research into the permission denied error I ran this command: git reset --hard master (from https://github.com/mxcl/homebrew/issues/2906)

    Now every file in my Wordpress directory gives me the remote:error: unable to unlink old 'directory/filename.php' (Permission denied) error (about 2000 of them)! The push seems to go through properly, but when I check the file I tried to push, the local file is changed, but the remote file is still unchanged.

    If it is not painfully obvious by now, I am fairly new to Git. Please help. I have to use Git for my new job. As a freelancer I did not need version control, but now this is the only tool I have to update the website, and I can't, and I'm worried.

  • badcrocodile
    badcrocodile almost 12 years
    Sorry, I could have explained that a bit better: When I need to make changes to our website I pull the files from our dev server (wp3dev). When I'm done I commit the changes and push the files. With that in mind, from what directory should I run the chmod -R u+w * command? On a directory on my computer, or on a directory on the test server?
  • rlc
    rlc almost 12 years
    @badcrocodile on your server, from the root of the site you deploy to (i.e. your remote working directory). Your error messages seem to indicate Git has trouble putting the files there -the chmod command should fix that.