Error:
fatal: this operation must be run in a work tree
This error below happend when somehow the git is as a bare and no working tree.
bare
Run this and it will fix the issue
git config --unset core.bare