Reputation: 201
I am a beginner. I try to use git to create the user's name. but when I typed
git config --global user.name "XXX"
the message shows
Unable to read current working directory: Operation not permitted.
I don't know what happened. How can I fix this problem?
Upvotes: 18
Views: 53064
Reputation: 499
I got this error in a pretty silly situation. I had a directory open in the terminal, but in Finder, I moved it to another location.
So, I was trying to execute this command in a directory that no longer existed.
I hope this helps someone :)
Upvotes: 2
Reputation: 7598
I had a similar problem after updating to MacOS Catalina 10.15 and updating Xcode Command-line Tools (xcode-select --install
).
I received the above error when simply trying to do git status
. Then noticed I couldn't even do ls
. Apparently it's necessary grant Terminal, or iTerm in my case, "Full Disk Access".
See this article for more details: https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/
UPDATE - 1/2023: I recently updated to MacOS Ventura 13.1 and ran into the same issue. Running xcode-select --install
did the trick for me. Another helpful article.
Upvotes: 78