Reputation: 168
I am getting this error for every git command I try to run and haven't found anywhere something similar. I have found stuff like "permission denied" and other problems to access the git configurations but nothing related to this "Is a directory" warning. I don't even know if it is related to the fatal error I am getting, but it is all the information I currently have.
user@computer:~/folder$ git status
warning: unable to access '/home/user/.gitconfig': Is a directory
warning: unable to access '/home/user/.gitconfig': Is a directory
fatal: unknown error occurred while reading the configuration files
Upvotes: 9
Views: 26967
Reputation: 21
I had the same issue on WSL2:
rm -R ~/.gitconfig
folder from windows.I then created the file ~/.gitconfig to prevent Docker from repeating this nasty behavior
Upvotes: 0
Reputation: 1
2020 update: you are going to have to add your username and email to the file
Upvotes: -2
Reputation: 8152
I had similar issue, because as the error says the ~/.gitconfig was a directory instead of being a file!
Junji's answer worked for me by renaming the directory but I faced the same error whenever I used git config --global command again as it was making another .gitconfig directory again. To solve this issue permanently, I removed the directory and made a file with the same name and it solved the issue forever as git config --global and other commands which need .gitconfig file could use this file.
I simply deleted the directory with:
rmdir ~/.gitconfig
and then made a blank new file with the same name:
nano ~/.gitconfig
That's it. Done!
Upvotes: 14
Reputation: 316
.gitconfig
is a global configuration file of git
tool.
Like this, your name, email, some tools... https://gist.github.com/gokure/3488458
Not sure how you created your .gitconfig
directory, but to be safe, rename it to .gitconfig_backup_dir
, then git
should then run flawlessly, cause git will not find $HOME/.gitconfig
but will work without it flawlessly.
Upvotes: 9