'.config/git/ignore': Permission denied

I am trying to push an app to Heroku using the CLI. When I enter the command git add . in the terminal, I keep getting this error:

/Users/me/.config/git/ignore': Permission denied
'/Users/me/.config/git/attributes': Permission denied

Can anyone help?

git


Solution 1:[1]

Here's how I solved it:

  1. In Terminal cd to the User director with cd ~.

  2. Change the directory permissions with sudo chmod 755 .config

  3. Enter your login password.

Solution 2:[2]

use this command to solve this problem ( commit to git ):

sudo chown -R hamid /Users/hamid

after that enter your Mac login password and allow that's dialogs appear

take attention that hamid is my username and you should enter your username instead of that . You can use the below command to get your username:

id -un

Solution 3:[3]

I had similar error messages outputting from git commands, though the usual set of git commands (pull, push, checkout, etc.) still worked just fine. sudo chmod 755 /home/your-username-here/.config/ followed by entering your login password successfully changed the permission and got rid of the error messages. Reference

Solution 4:[4]

While you might be the owner of the files, check the permission of the parent folders .config, .config/git (as in here)

And check if the session in which you push to Heroky has the right HOME anbd XDG_CONFIG_HOME environment variable values.

Solution 5:[5]

This is the command that worked for me:

sudo chown -R USER:(id -gn $USER) /Users/myusername/.config

The only thing that changed here was myusername; the other places where it mentioned USER were left the same.

Solution 6:[6]

I had to add the private ssh key to my SSH agent. I was able to do this through command line, then Git Kraken worked.

eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_rsa

"id_rsa" or whatever you have named your private key and public key pair that you have added to your github.

reference: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Solution 7:[7]

$ git config --global core.fileMode false

use this and then commit changes and then check the log it will work.

Solution 8:[8]

/Users/me/.config/git/ignore': Permission denied
/Users/me/.config/git/attributes': Permission denied

Solution: For this go to terminal just run command below :

sudo chmod 755 /Users/your-username/.config

in your case it will be :

sudo chmod 755 /Users/me/.config

Solution 9:[9]

As suggested by @seanv507 in the comments section, the answer is similar to this answer. The copy/pasta is:

cd ~/
ls -al
<Noticed .config was owned by root, unlike everything else in $HOME>
sudo chown -R $(whoami) .config

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3
Solution 4 VonC
Solution 5 Jeremy Caney
Solution 6
Solution 7 Daemon Painter
Solution 8 Al-Amin Sarker
Solution 9 pyjavo