简体   繁体   中英

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

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.

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 .

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.

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

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

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

我在 Visual Studio 2017 中遇到了同样的问题。我的解决方案是关闭 Visual Studio,然后打开 Visual Studio CODE 并在那里合并文件。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM