Why do I get "fatal: git status --porcelain failed"?
Solution 1:
Oh dear I'm such a fail. It looks like the problem stems from Flash Builder copying over other .git repos into sub folders. The answer is to remove all .git folders that aren't the repo's one.
Solution 2:
I ran into this error because of a corrupted/not properly initialized submodule (with its own .git subfolder). I temporarily deleted the submodules folder and used git init
in the main project's root. Fixed the problem for me.
Solution 3:
I know this is an old thread, but I just had the same problem and ended up solving in a different way. The git init
didin't work for me.
Posting here, in case it's useful to anyone else.
My repository has two submodules. After rebasing I started getting the error fatal: git status --porcelain failed.
The solution was to verify the property worktree
in every submodule config
file - e.g. <repository-checkout>/.git/modules/<submodule-name>/config
.
I had one invalid path for the worktree
property. It was linking to an unexisting folder that was changed and merged to master
- probably due an error resolving conflicts.
Solution 4:
In case it helps anyone else, I just encountered the same issue and found that running git init
in the project root fixed it.
Solution 5:
I had the same issue. Running git status
in my root project's directory produced the following error:
fatal: This operation must be run in a work tree
fatal: 'git status --porcelain' failed in submodule js/object-subscribe
Running git status
in the affected submodule (js/object-subscribe
) would produce this error:
fatal: This operation must be run in a work tree
Running git init
in that submodule's folder did it for me.