You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git Push卡住并出现Bad File Descriptor问题求助

Git Push Stuck After "Writing objects: 100%" in Single Repository

Problem Details

  • Issue occurs only in a single Git repository
  • git push gets stuck immediately after outputting:
    Writing objects: 100% (823/823), 73.56 MiB | 34.07 MiB/s, done.
    Total 823 (delta 522), reused 752 (delta 454), pack-reused 0
    
  • Adjusting buffer with git config --global pack.windowMemory "32m" improved transfer speed but did not resolve the stuck issue
  • strace -efile -f git push output shows:
    Writing objects: 100% (823/823), 73.56 MiB | 34.07 MiB/s, done.
    Total 823 (delta 522), reused 752 (delta 454), pack-reused 0
    [pid  2380] newfstatat(1, "", 0x7ffea1c08270, AT_EMPTY_PATH) = -1 EBADF (Bad file descriptor)
    [pid  2380] +++ exited with 0 +++
    [pid  2375] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2380, si_uid=1000, si_status=0, si_utime=70 /* 0.70 s */, si_stime=20 /* 0.20 s */}
    

Troubleshooting & Solutions

1. Reset Remote Connection

  • Remove and re-add the remote origin to fix potential connection corruption:
    git remote remove origin
    git remote add origin <your-remote-repo-url>
    
  • Pull latest changes to avoid conflicts before pushing:
    git pull origin <your-branch-name> --rebase
    

2. Repair Local Repository Corruption

Single-repository issues often stem from local repo damage. Run these commands to fix:

  • Clean up local cache aggressively:
    git gc --prune=now --aggressive
    
  • Check for and repair repo integrity issues:
    git fsck --full
    
    If git fsck reports errors, re-cloning the repository is the most reliable fix (back up uncommitted changes first).

3. Disable Progress Output

The EBADF error suggests a problem with stdout/stderr handling. Try pushing without progress output:

git push --no-progress

If this succeeds, configure the repo to disable progress by default:

git config --local transfer.hideProgress true
git config --local core.compression 0

4. Fix File Descriptor Issues

EBADF indicates an invalid file descriptor. Try these steps:

  • Open a new terminal window and re-run git push (current shell environment may be corrupted)
  • Check current file descriptor limits:
    ulimit -n
    
  • Temporarily raise the limit if it's too low:
    ulimit -n 10240
    
    Then attempt the push again.

5. Re-clone the Repository

If all else fails:

  1. Stash or back up uncommitted changes:
    git stash push -m "temp backup"
    
  2. Delete the local repo and re-clone from remote:
    rm -rf <your-local-repo-dir>
    git clone <your-remote-repo-url>
    
  3. Restore your changes and push:
    git stash pop
    git push
    

内容的提问来源于stack exchange,提问作者user2609605

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 00:20:26