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
.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.
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!
2020 年更新:您必须将您的用户名和电子邮件添加到文件中
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.