3

I set up git with

git config --global user.name myuser
git config --global user.email my@email.com

when I try to commit my new repo through github for mac I get this error:

fatal: unable to access '/usr/local/etc/gitconfig': Permission denied (128)

I have read the documentation on github and followed their instractions, but didn't get anywhere.

Could you help fix it?

sigul
  • 97
  • 1
  • 6
  • What are the permissions on that file? Run `sudo ls -l /usr/local/etc/gitconfig` to check. – Mark Setchell Jun 20 '15 at 00:39
  • It comes out I don't have the file, event if git config --list returns my parameters – sigul Jun 20 '15 at 06:26
  • Did you maybe install it using `homebrew`? – Mark Setchell Jun 20 '15 at 06:29
  • no, I don't know about homebrew. I used the git installer. I located the gitconfig file in /usr/local/git, tried to create /etc and copy the file there, chmod 755 it, and nothing changed, same error. thank you for helping – sigul Jun 20 '15 at 06:47
  • Try temporarily changing your name and see if that works and which file it updates `git config --global user.name freddyFrog`. – Mark Setchell Jun 20 '15 at 07:02
  • I can only imagine you configured your `user.name` and `user.email` when logged in as, or `su'ed to another account, or that you somehow have multiple, conflicting `git` installations. Try this command to find *ALL* gitconfig files `sudo find / -name ".gitconfig" -ls` – Mark Setchell Jun 20 '15 at 07:19
  • config --list returns changes, but I can't locate the file who's changed. I deleted /usr/local/git (I don't know how, may re-installing git), but the config file is still present and updated through git config --global – sigul Jun 20 '15 at 07:25
  • sudo find / -name ".gitconfig" -ls returns /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory 21195287 8 -rw-r--r-- 1 root wheel 26 Jun 20 09:19 /private/var/root/.gitconfig 21195299 8 -rw-r--r-- 1 silvio staff 60 Jun 20 09:20 /Users/silvio/.gitconfig – sigul Jun 20 '15 at 07:37
  • So you have run `git config` both as root and as silvio.- was that your intention? EIther way, you have 2 git identities. I guess you also have two versions of the `git` binaries - one from Apple in `/usr/bin/git` and one from your own installation from the git installer in `/usr/local/bin` - can you run `ls` on both those locations and report back? I suspect the problem is that your PATH is not set to consistently choose one or the other git installations. – Mark Setchell Jun 20 '15 at 07:49
  • it seems I have not installed the apple git (???), but I just installed xcode on yosemite. any idea? `sh-3.2# cd /usr/local/bin` `sh-3.2# ls` `git-lfs github pandoc pandoc-citeproc` `sh-3.2# cd /usr/bin/git` `sh: cd: /usr/bin/git: Not a directory` – sigul Jun 20 '15 at 08:08

1 Answers1

0

git config --global is supposed to write in $HOME/gitconfig, your global config.

Double-check $HOME when you are typing this command, because if /usr/local/etc/gitconfig is more of a system config file, more likely owned by root.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I don't have the file, tried do copy if from /usr/local/git, but the error is still there. how can I check $home? thx – sigul Jun 20 '15 at 06:52
  • Don't try to copy it, just make sure $HOME is correctly set. Also check your other environment variables: make sure you don't have some starting with GIT_. A `git config --global ` should create the `gitconfig` file at the right place, with the correct access rights. – VonC Jun 20 '15 at 08:30