git status returns fatal: Not a git repository but .git exists and HEAD has proper permissions

后端 未结 8 745
无人及你
无人及你 2020-12-02 12:24

When I run git status on my repo I get fatal: Not a git repository: /my repo/.git/modules/docs

I\'ve checked and .git exists and contains HEAD with the

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 12:24

    Following @ax003d answer, you could replace all old paths (old/path) with the new path (new/path) using this command:

    find . -type f \( -name ".git" -o \( -path "*.git/modules/*" -name config \) \)  -print0 | xargs -0 sed -i -e "s#old/path#new/path#g"
    

    You might want to check what the old paths look like before replacing them:

    find . -type f \( -name ".git" -o \( -path "*.git/modules/*" -name config \) \)  -print0 | xargs -0 grep --colour "old/path"
    

提交回复
热议问题