moped
moped

Reputation: 2247

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

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

Upvotes: 9

Views: 25419

Answers (8)

azeem
azeem

Reputation: 361

I faced same issue. I just resolved this issue with the following steps:

1- Close Visual Code

2- Open project on git bash command line

3- Commit the code again

Upvotes: 2

Jona
Jona

Reputation: 1156

I also have mapped my root webspace as a drive. This is no problem until files are watched (like with npm run watch).

Upvotes: 2

Beslo
Beslo

Reputation: 1

I just had the same problem. In my case the problem was low disk space. Hope this helps someone.

Upvotes: 0

Maxter
Maxter

Reputation: 834

I had the same problem with visual studio 2017. My solution was to close visual studio, then open Visual studio CODE and merge the files there.

Upvotes: 1

Whelkaholism
Whelkaholism

Reputation: 1495

I have had this error a lot recently, and the above answers helped, but another thing that also seems to cause it is VS itself running.

Try closing VS, then doing a "Git Bash Here" from Explorer and using the command line only.

Once done you can then reopen VS.

Upvotes: 6

Nathan Clement
Nathan Clement

Reputation: 1213

Restarting VS Code works. A bit easier than disconnecting and re-mapping the folder (which also works).

Upvotes: 0

James Bailey
James Bailey

Reputation: 508

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.

Upvotes: 9

RaSor
RaSor

Reputation: 877

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.

Upvotes: 15

Related Questions