Git clone fsync input/output error in linux

The problem was that I was trying to clone in the nfs file system. The solution is to clone the repo in non-nfs location, and then move the folder to the desired nfs location.

cd /tmp   (non nfs location)
git clone blablabla.git
mv blablabla ~

Short answer: Use "eatmydata" (thats a program, check "apt install eatmydata")

Long answer: Git calls the "fsync()" system call frequently, to make sure the repository is consistent. This is important especially when multiple people use the same repository concurrently and also to make sure the repository is in a defined state should for example power get interrupted. After a pack file is written, it is forced to be synced (aka finished writing to the actual disk and not still in buffers) before metadata is updated.

Some filesystems - especially remote filesystems like NFS, sshfs, ... do not support fsync() but git has no flag to disable these calls.

What can help - under linux - is a wrapper called "eatmydata". Any program called through the wrapper will have its fsync() calls simulated without actually syncing. While this increases the risk of repository damage, should the write not actually go through, this is often acceptable when manually supervising the process.

just install eatmydata, then call

eatmydata git clone --recursive https://github.com/tensorflow/models.git
sync