[Git] Unable access xxx: Is a directory

When I run git status, it shows the below error

warning: unable to access '/etc/gitconfig': Is a directory
warning: unable to access '/etc/gitconfig': Is a directory
warning: unable to access '/etc/gitconfig': Is a directory

The solution is to remove /etc/gitconfig. The target /etc/gitconfig might be varied from each case. With the below command, all can be solved.

sudo rmdir /etc/gitconfig

The reason that the problem suddenly pops up is because I ran a experiment docker command something like docker run --rm -v /etc/gitconfig:/etc/gitconfig ..... So the /etc/gitconfig is created.


If this post helped you to solve a problem or provided you with new insights, please upvote it and share your experience in the comments below. Your comments can help others who may be facing similar challenges. Thank you!
Buy Me A Coffee
DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !