'yarn kbn bootstrap failed while trying to prepare kibana dev env

I am trying to generate the Kibana plugin and for that I already downloaded the .zip file from the github. However while preparing for the Kibana development environment, I got an error as mentioned below from yarn kbn bootstrap cmd:

ERROR UNHANDLED ERROR

ERROR Error: Command failed with exit code 128: git merge-base HEAD FETCH_HEAD fatal: Not a valid object name HEAD

Note:

I already sudo git init

Steps followed so far

sudo wget https://github.com/elastic/kibana/archive/refs/tags/v7.17.0.zip
sudo apt-get install unzip
sudo unzip v7.17.0.zip
sudo mv kibana-v7.17.0 kibana
sudo chmod -R 777 kibana-7.17.0
sudo yarn add require-in-the-middle
sudo yarn add symbol-observable
sudo yarn add source-map-support
sudo yarn add lodash
sudo git init
sudo yarn kbn bootstrap  -- failed
  ERROR UNHANDLED ERROR
  ERROR Error: Command failed with exit code 128: git merge-base HEAD FETCH_HEAD
        fatal: Not a valid object name HEAD


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source