15

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?

Pang
  • 9,073
  • 146
  • 84
  • 117
denskiz
  • 151
  • 1
  • 2
  • 5
  • Is this same as yours? https://stackoverflow.com/questions/4269922/permission-denied-publickey-when-deploying-heroku-code-fatal-the-remote-end – Sahan Serasinghe Jun 29 '17 at 01:58
  • 2
    @Sahan No. That question is about a remote server denying the push. This is about local file permissions. – Jonathon Reinhart Jun 29 '17 at 01:59
  • 2
    What're the owner, group, and permissions on that attributes file? – jpmc26 Jun 29 '17 at 02:06
  • I am the owner and I have read and write permissions on the file. – denskiz Jun 29 '17 at 02:11
  • I believe this is the same error as https://stackoverflow.com/a/47995027/. basically if you run a command with sudo and it creates the .config directory then root becomes owner. git then checks the .config (now its created and causes the error) – seanv507 Nov 28 '19 at 14:22

10 Answers10

23

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.
MeltingDog
  • 12,714
  • 38
  • 143
  • 270
3

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
Hamid Reza Ansari
  • 917
  • 11
  • 15
1

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

0

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.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
0

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.

Jeremy Caney
  • 6,191
  • 35
  • 44
  • 70
0

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

rcadby
  • 11
  • 4
0
$ git config --global core.fileMode false

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

Daemon Painter
  • 2,785
  • 2
  • 24
  • 38
0
/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
Al-Amin Sarker
  • 499
  • 3
  • 15
sapna
  • 1
0

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
pyjavo
  • 1,471
  • 2
  • 23
  • 36
-3

Use sudo before write the command.

sudo git add.
manu
  • 177
  • 2
  • 9