3

I have a development machine that use runs on CentOs.

Whenever i pull from git using git pull i get "permission denied" issue/error.

Git apparently doesn't have the permission to overwrite the files needed when i do a pull. Thus after every time i have to sudo git pull to get it to work.

I would rather not do a sudo git pull because i'd like everyone to be able to pull from our development server.

How do i configure git to have the proper permissions to just be able to pull without sudoing? Is this because I may have not configured git properly? If so how do i configure git to allow the correct permissions?

Not sure if this helps but a which git reveals this:

/usr/bin/git

Example error

i execute: git commit -m "my fun message" i get:

error: Unable to append to .git/logs/refs/heads/stage: Permission denied fatal: cannot update HEAD ref

2
  • “Permission denied” from what? Is the repository local or remote? What are the permissions on the repository? Jul 19, 2011 at 20:47
  • Good point. I've updated my question
    – chrisjlee
    Jul 19, 2011 at 20:54

1 Answer 1

7

Git itself doesn't have any permissions. It relies entirely on the operating system level permissions.

If you're the only person using that git repo, then do this:

cd dir_of_repo
sudo chown -R ${LOGNAME} $(pwd)
sudo chmod -R u+rwX $(pwd)

If you're sharing this with other people, then you probably need to read Understanding UNIX permissions and chmod.

2
  • What do those commands do?
    – chrisjlee
    Jul 20, 2011 at 0:07
  • 1
    You should read that link that I already posted. Those commands make you the owner and give you full permission over the repo directory.
    – bahamat
    Jul 20, 2011 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .