For my case, my
~/.gitconfig file was pointing(symlinked) to my old dotfiles, which I had moved to a different location, meaning the
gitconfig was pointing to an inexistent file.
To know where my
gitconfig was symlinked to, I did
ls -la ~/.gitconfig, which showed that it was pointing to a file I had moved elsewhere.
I had to update the symbolic link to my new dotfiles (dotfiles is just a folder name of all my .smth files).
To update the symlink, I did
ln -sf ~/your-new/path-to/gitconfig.symlink ~/.gitconfig
Everything then worked well
ls -la /path/to/file/.gitconfig)