0

I have an empty git directory I'd like to remove, however

"git rm -r NameOfDirectory" is returning "operation not permitted".

In addition, if I move a new file into this directory then do git status, git does not list it as a new untracked file, but it does if I move the file into another directory, so there's something strange about it.

How I can get rid of this directory?

git rm -r -f doesn't solve it.

5
  • You don't have permission to remove the directory. Either use sudo or get someone who has the necessary permissions to remove the directory for you. Commented Mar 28, 2013 at 16:12
  • Thank. But it was me who added that directory in the first place, how could I suddenly not have permission for this particular directory? Commented Mar 28, 2013 at 16:15
  • Because you're a different user? Again: use sudo or ask someone with the correct permissions. Commented Mar 28, 2013 at 16:18
  • Could you post the result of a ls -l on the parent directory? Commented Mar 28, 2013 at 16:21
  • I've resolved it, there as a hidden OS X .DS_Store file in the directory, when I deleted that things were ok. Thanks for every bodies answers, I've learned a few new things about Git due to your replies. Commented Mar 28, 2013 at 16:24

2 Answers 2

2

It's a permission issue.

try

sudo git rm -r NameOfDirectory with the root password

You may try to remove the directory without using the git command but the rm command directly.

rm -r NameOfDirectory or sudo rm -r NameOfDirectory

Sign up to request clarification or add additional context in comments.

2 Comments

I'm using the terminal in OS X, and when it prompts me to enter the password the terminal isn't accepting any input from the keyboard, so I'm unable to actually enter the password.
What Jack said. It just doesn't show you what you're inputting, since it's sensitive information.
1

Git doesn't track empty directories. If you have an empty directory in your working tree you should simply removed it with rmdir. There is no need to involve Git.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.