Bad File Descriptor while running git clone

We sometimes get the below error when trying to clone a git repo:

fatal: write error: Bad file descriptor
fatal: index-pack failed

To resolve that, you can clone the repo in the /tmp directory and then move it to your home directory. You can move to the tmp directory by using:

cd /tmp

After that, create a directory with your username to avoid ownership issues, and clone the repo inside the newly created directory. After the repo gets cloned, move the repo directory to your home directory by-

mv source destination

where, source is the path of the directory which you want to move, and destination is the path of the directory where you want to move the source directory.