I used the mv
command to move my repository and now running any Git command gives me
fatal: Not a git repository (or any of the parent directories): .git
The .git
folder does indeed exist and all looks ok but it just won't work. Can I rerun the git init
here without losing anything?
This usually is the symptome of some kind of corruption within your .git
directory during the move.
git init
shouldn't be the solution here (unless you want to start over).
Example of corruption:
.git
: restoring the refs
manually was enough HEAD
no longer there : "when compared to a newly created test repository it became obvious that the one commit on the vfat partition had changed the filename HEAD to head…must be a default policy for case-insensitive filesystems" So the idea would be to clone your repo and compare the .git
to the one you just moved, in order to see if there is any difference.
But that supposes you already pushed your repo elsewhere, in order to be able to clone it (since your current -- moved -- repo seems corrupt).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.