# What is "/usr/local/etc/gitconfig"?



## Tomonf613 (Oct 30, 2019)

Hi, I'm a freeBSD bigginier.
When tryinug git command, on non-root user,  I get an error message:

fatal:  unable to access '/usr/local/etc/gitconfig' : Permission denied.

BUT there is no gitconfig file or directory not only in /usr/local/etc but also another directory like /etc/.
And when making  '/usr/local/etc/gitconfig', permission is ok, I get same error message.

What does this error message mean?


----------



## ShelLuser (Oct 30, 2019)

It means something went wrong. How did you install Git?


----------



## Tomonf613 (Oct 31, 2019)

Git was installed by pkg command. And then git command went well on  non-root account. But no gitconfig ( or .gitconfig) file exists in /usr/local/etc/ , home or root dir. 
Once, I accidently changed permission of /usr/local/etc, from defoult to non-root account (group is wheel). And I fixed permission  to root:wheel.
Then I get " unable to access '/usr/local/etc/gitconfig' : Permission denied. " message.

I tried to make git-related-files, like /usr/local/bin/git, belong to non-root a ccount  but still I've not resolved this problem.


----------



## ShelLuser (Oct 31, 2019)

In which case the main issue here are the permissions on /usr/local/etc. Those should be 755, you might want to check that too.


----------



## Tomonf613 (Oct 31, 2019)

With your helpful advice, I enabled git command without the error message. Thanks!

...But why the message about non-exist-file appeared?


----------



## ShelLuser (Oct 31, 2019)

Tomonf613 said:


> ...But why the message about non-exist-file appeared?


Probably a bit of a bug. By default git checks for 3 "levels" of configuration: _repo_ (in the repository folder), _user_ (in your home directory) and _system_ (in the global system configuration, for Unix this is etc). My guess is that it couldn't access /usr/local/etc at all which made it go bonkers.

For the record: there's plenty of software which would run into serious problems if they couldn't access etc, but I agree that the error message itself is a little misleading.


----------



## fluca1978 (Nov 5, 2019)

I don't think the message is misleading, since it clearly states _access denied*.*_ The problem is that probably the OP checked the file as root, not as a normal user that would have seen the same error on the console.


----------



## ShelLuser (Nov 6, 2019)

fluca1978 said:


> I don't think the message is misleading, since it clearly states _access denied*.*_


For /usr/local/etc/gitconfig which doesn't exist. It would be more useful if it mentioned that /usr/local/etc is inaccessible instead of a non-existing file.


----------



## fluca1978 (Nov 6, 2019)

Again, I don't think the message is wrong, or we should redefine a lot of messages.


```
% mkdir foo
% chmod 000 foo
% ls foo/bar
ls: foo/bar: Permission denied
```

so _Permission denied_ is something that did show up every time you try to access a file under a restricted directory. After all, how can you know a file is not there if you cannot list the directory?


----------

