Running flutter doctor spits out error: Standard error: fatal: bad object HEAD

Viewed 1366

I had installed Flutter and Android Studio from the official websites. I am novice to Git, GitHub, mobile development and android development.

I was trying to run flutter doctor command in the Command Prompt (Windows 10). However, it spits an error in bright red saying:

Failed to find the latest git commit date: VersionCheckError: Command exited with code 128: git -c log.showSignature=false log -n 1 --pretty=format:%ad --date=iso Standard out: Standard error: fatal: bad object HEAD Returning 1970-01-01 05:30:00.000 instead.

Plz help me with this issue. I did face network issues while downloading but I resumed the download in time (in Chrome). I do NOT want to reinstall Flutter all over again because of data issues! Also because setting up this whole thing was really enervating!

1 Answers

You are correct, this is caused by incomplete or corrupted download. You may try the following-

  • initiliase the git repo again by-
git init
  • then fetch the missing files from the remote, by
git fetch
  • If you are facing, some kind of error, like 'your tree is behind HEAD', do-
git pull
  • lastly, check the status by
git status

you should get something like this in output-

On branch stable
Your branch is up to date with 'origin/stable'.

nothing to commit, working tree clean.
Related