Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to read current working directory: Operation not permitted

Tags:

git

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?

like image 279
Joanne Wei Avatar asked Apr 12 '20 06:04

Joanne Wei


2 Answers

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".

  1. Go to System Preferences -> Security & Privacy -> Privacy tab
  2. Select "Full Disk Access" from the left-side menu
  3. Add Terminal and/or iTerm to the app list

See this article for more details: https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/

like image 147
kenecaswell Avatar answered Nov 15 '22 05:11

kenecaswell


Check your home directory and .gitconfig file permissions using ls -l command. If all is ok try to use sudo chattr -i .gitconfig to check immutable attribute on this file.

You can find details about this command and file attributes here.

like image 41
ceth Avatar answered Nov 15 '22 03:11

ceth