Why do I get “fatal: git status --porcelain failed”?

前端 未结 13 1915
星月不相逢
星月不相逢 2020-12-09 07:39

This is a huge pain in the bum. I\'ve got this a few times before and I don\'t understand why. 5 mins ago the repo was fine and working, I move some files around (which is a

13条回答
  •  执笔经年
    2020-12-09 08:27

    In my case after moving moduleA/mySubmodule to moduleB/mySubmodule using git mv moduleA moduleB with git 2.12.2, I ran into the following error:

    $ git status
    fatal: Could not chdir to '[../]moduleA/mySubmodule': No such file or directory
    fatal: 'git status --porcelain' failed in submodule mySubmodule
    fatal: 'git status --porcelain' failed in submodule moduleB
    

    Then I did the following (Maybe not in this order)

    1. Manually update .gitmodules entry to moduleB
    2. Enter .git/modules and rename old module folder
    3. Enter moduleB and delete submodules folder
    4. Run git submodule sync and git submodule update

    After that, I could run git status again without problems.

提交回复
热议问题