Solved! Warning: Unable to Access /Users/Name/.config/git/attributes Permission Denied

I attempted to update the Homebrew on my Mac by running the command in Terminal, but it returned the error message saying “warning: unable to access /Users/Name/.config/git/attributes Permission Denied.” Does anyone know why this error occurs and how to fix it?

When working with Homebrew, Git, or a similar program from the command line, you can see an error message that reads, “warning: unable to access /Users/Name/.config/git/attributes”: Permission denied. Just as the error says, there are some problems with the ownership of the files or directories you want to access.

You may receive such error messages in Terminal as below:
% brew update
warning: unable to access ‘/Users/Paul/.config/git/ignore’: Permission denied
warning: unable to access ‘/Users/Paul/.config/git/attributes’: Permission denied
warning: unable to access ‘/Users/Paul/.config/git/attributes’: Permission denied
warning: unable to access ‘/Users/Paul/.config/git/ignore’: Permission denied
Updated 2 taps (homebrew/core and homebrew/cask)

When you look into the ownership of the.config directory and its files and subdirectories after receiving this error, you will find that those files/folders are owned by root.

This usually occurs when you run a previous operation as root or with sudo, such as brew, git, htop, or anything similar, which causes the.config directory or a subdirectory to be created with root ownership.

This error message sounds more severe than it usually is, but you probably want to resolve the permissions issue and fix the error so that you don’t get the “unable to access ~/.config/git/attributes” prompt. The ownership of the involved files and/or directories must be changed to fix this error warning. With the chown command, you can get rid of it.

Here’s how:

  1. Open Terminal via Spotlight and go to the root directory with the command:
    cd ~/
  2. Then type the following command, you need replace with your username:
    sudo chown -R username /Users/username