I am able to see global and local config files at usual locations.
But if i type
git config --system --list
it gives me
fatal: unable to read config file '/Library/Developer/CommandLineTools/usr/etc/gitconfig': No such file or directory
There is no file at /etc/gitconfig or $HOME/.config/git (prescribed location got *nix and osx respectively)
EDIT
doing
sudo git config --system --list
does not help
@Abhijit Mazumder:
I know this is an old question, but I had a similar issue when attempting to set a system level git config value on my mac and thought I would post my solution here in case it could help you.
NOTE: I strongly suspect that if you simply create the '/Library/Developer/CommandLineTools/usr/etc/' directory and create a file called gitconfig within that directory, then your attempts at viewing or setting system level git config values will be successful.
My first attempt at setting a system level git config value on my mac was:
git config --system alias.cl clone
This resulted in an error:
error: could not lock config file /Applications/Xcode.app/Contents/Developer/usr/etc/gitconfig: No such file or directory
I thought perhaps I needed to add 'sudo' to the command:
sudo git config --system alias.cl clone
But running the command with 'sudo' gave me the same error:
error: could not lock config file /Applications/Xcode.app/Contents/Developer/usr/etc/gitconfig: No such file or directory
So, from the root directory on my mac, I switched into the 'usr' directory mentioned in the error, just to see what was in there:
cd Applications/Xcode.app/Contents/Developer/usr/
I was surprised to find that there was no 'etc' directory. The only directories I saw were 'bin', 'lib', 'libexec', and 'share'.
So I decided to create what was missing. I first created an 'etc' directory:
sudo mkdir etc
And then created a gitconfig file in the 'etc' directory:
sudo touch etc/gitconfig
I was then able to set a system level git config value with the following command:
sudo git config --system alias.cl clone
In order to confirm that the system level git config value had actually been set, I viewed the contents of the gitconfig file.
I first used the unix 'cat' command while inside my 'usr' directory:
cat etc/gitconfig
The output from the 'cat' command was:
[alias]
cl = clone
Then I used a git command (the same one you were trying to use in your question) to check that my system level git config value had been set:
git config --system --list
The output from this command was:
alias.cl=clone
The last thing I needed to do to ensure that I had placed my file in the proper location was try the alias I had created, so I tried running:
git cl
Running this command using the alias I created resulted in the following output, which confirmed for me that everything was working properly:
You must specify a repository to clone.
usage: git clone [<options>] [--] <repo> [<dir>]
-v, --verbose be more verbose
-q, --quiet be more quiet
--progress force progress reporting
-n, --no-checkout don't create a checkout
--bare create a bare repository
--mirror create a mirror repository (implies bare)
-l, --local to clone from a local repository
--no-hardlinks don't use local hardlinks, always copy
-s, --shared setup as shared repository
--recursive initialize submodules in the clone
--recurse-submodules initialize submodules in the clone
--template <template-directory>
directory from which templates will be used
--reference <repo> reference repository
--dissociate use --reference only while cloning
-o, --origin <name> use <name> instead of 'origin' to track upstream
-b, --branch <branch>
checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
path to git-upload-pack on the remote
--depth <depth> create a shallow clone of that depth
--single-branch clone only one branch, HEAD or --branch
--separate-git-dir <gitdir>
separate git dir from working tree
-c, --config <key=value>
set config inside the new repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With