Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: fatal: fsync error on 'sha1 file': Bad file descriptor

Tags:

git

windows

I'm using VS Code with Git - it's in portable location C:\_DEV\bin\git and is also added to Windows PATH so it works just fine with no remotes.

I have a OneDrive _GIT folder where I have some of my "remote" repositories, that sync between 2 devices (sometimes, I have it there mainly for backup purposes).

The error appears when I want to commit changes, only way to "fix" this issue is to restart the computer, so I'd like to find a way how to fix it properly. The problem is, it doesn't appear always and not for all repositories, it's pretty random.

I think it's because of sync from/to OneDrive. Is there a command I can run to fix the file descriptor? Or other way to prevent it?

git remote --verbose
git ls-tree -l HEAD -- a:\new\theme\assets\sass\main.scss
git show 97a333c5e7fce816dbb46a5c1235d69e61836726
git show HEAD:theme/assets/sass/main.scss
git add -A -- a:\new\theme\assets\sass\main.scss
fatal: fsync error on 'sha1 file': Bad file descriptor
like image 358
moped Avatar asked Dec 21 '17 17:12

moped


2 Answers

Thanks to @edward-thomson.
I had same problem on my PC, where i mapped a folder under my homedrive to E:

C:\Users\myuserid\E-Folder\SomeGitProject

by sharing the folder, so i could shortcut it to

E:\SomeGitProject

Solution was to use the full path in CMD or use the shortcut to homedrive from git bash:

~/E-Folder/SomeGitProject

I guess your A: likewise is a share, that you can access with a full path probably also located somewhere under your homedrive.

like image 109
RaSor Avatar answered Sep 22 '22 13:09

RaSor


I am posting late to help others get to the solution faster than I did. The actual culprit was elusive, and I tried everything from re-installing GIT to creating new repositories.

This happened to me in windows and it was due to a change in permissions in a parent folder somewhere.

The solution was to simply disconnect and remap the folder.

like image 27
James Bailey Avatar answered Sep 25 '22 13:09

James Bailey