1

After running the command git pull, I get the following messages:

 * branch            abc_branch   -> FETCH_HEAD
Updating 64d3953..e881e1a
warning: unable to unlink dist/stylesheets/2ada1348.abc.min.css: Permission denied
error: unable to create file dist/index.html (Permission denied)
...
error: unable to unlink old 'dist/partials/views/foo.html' (Permission denied)
...

I use Macbook Pro. After either changing the directory write permission or delete local file, I get the same type of result of running git pull. For the "unable to create file dist/index.html" error, I run the following command:

sudo chmod go+w dist

and for the "unable to unlink old 'dist/partials/views/foo.html'" error, I run

sudo rm dist/partials/views/foo.html

One thing I don't understand is that I only have this permission denied problem with a GitHub repository while I don't have a such problem for other 3 repositories under the same GitHub user account. The only differences between the repository and the other three is that my interaction with this one has been idle for four weeks or so.

TeeKai
  • 671
  • 2
  • 10
  • 20
  • This definitely sounds like a filesystem permissions issue. Could you please go into more detail about what you've done (exactly what do you mean by `changing the directory write permission or delete local file`)? – Guildencrantz Jan 11 '16 at 04:18
  • Two points: 1) You've only changed the permissions of ``, not anything in it, so there could well still be a permissions problem. 2) Are you sure that the ownership of the files are correct? Even if you run `chown -R go+w ` it won't work if you aren't the owner (or aren't in the group) with permissions to the files/directories. – Guildencrantz Jan 11 '16 at 04:55
  • possibally duplicate http://stackoverflow.com/questions/13195814/trying-to-git-pull-with-error-cannot-open-git-fetch-head-permission-denied – Punit Vara Jan 11 '16 at 04:59
  • Accidentally pulled with sudo? Check owner of files. – sectus Jan 11 '16 at 05:40
  • Do you mean that I need to change the write permission to all of sub-directories? What is a correct ownership of those files in the repository? – TeeKai Jan 11 '16 at 05:46
  • It seems to be the situation as sectus says. The ownership of some of files is root instead of me. – TeeKai Jan 11 '16 at 06:02
  • After changing the ownership to be the same as other repositories, I still run into the same problem. – TeeKai Jan 11 '16 at 07:05
  • Do you have any process locking those files, preventing them to be unlinked? Try killing as many process as you can before attempting the `git pull` again. – VonC Jan 11 '16 at 07:06

0 Answers0