Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am a beginner at OSX/Unix command line.

I have a GIT repository that was created on my OSX computer. Recently I cloned the repo and went to run a bash script within the repo via ./ This is giving me a permission denied error. So i ran chmod 777 ./ The next time I ran ./ it worked, except the bash file calls other files within it that then had "Permission Denied" errors. I then logged into a terminal session as super user via sudo -s and ran the ./ command, but I am still getting permission denied errors.

How should I fix this, do I need to recursively chmod 777 the entire repo directory? Why does using Sudo not let me have permission?

One thing to note, is that when I originally created the repo on my computer, I could run all the commands without a problem. Since cloning the repo I have been having permission denied errors.

share|improve this question

You cannot directly execute a file that does not have the execute permission bit set. Using sudo will allow you to (attempt to) execute a file that has any execute bit set at all, but if no execute bit is set, you will get "permission denied", no matter who you run as.

You can check whether git thinks the file permissions are different from what they should be by running git status - it will show files as modified if they changed permissions; if that's it, you can fix it as described on stackoverflow.

If git thinks everything's fine, but permissions between your source and your clone repository differ, maybe you're using some odd filesystem that's confusing git's notion of what permissions the files should have, or maybe you have a git config option set (see an older answer to the same question). Whatever the cause, you need to do the same thing: copy the original permissions and apply them to your clone; this was previously answered here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.