'git status fatal: this operation must be run in a work tree

fatal: this operation must be run in a work tree. Error occured when trying git status on a remote repo.

I've created a bare git repo on my remote server and cloned it to my local directory. After creating files, staging and committing, I pushed the local repo back to the remote server.

$ git push --set-upstream origin master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 3.26 KiB | 1.63 MiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To 45.76.179.23:~/gittest/test.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

And I've tested cloning it in another directory. My changes is successfully updated. However, when I checked git status on the remote server, error occured.

gituser@vultr:~/gittest/test.git$ git status
fatal: this operation must be run in a work tree
git


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source