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

Git LFS迁移生成提交无效:缺失日期前空格且日期异常

Fixing Invalid Commit from Git LFS Migrate with Missing Space Before Date Error

Let's break down what's going on here: when you ran git lfs migrate import --no-rewrite luca/models/weights/yolov5m.pt, Git LFS generated a commit with broken author/committer metadata—specifically, there's a missing space between your email address and the date string. Git couldn't parse this messed-up line correctly, so it defaulted the date to the Unix epoch (Thu Jan 1 00:00:00 1970 +0000) and threw that missingSpaceBeforeDate error during git fsck.

Here's how to fix this, depending on where the bad commit sits in your history:

1. If the bad commit is your latest (unpushed) commit

  • First, run git show 1e39456 again to check the exact author line—you’ll likely see something like Author: Luca<luca@example.com>Thu Jan 1... (no space after the email closing bracket or before the date).
  • Fix the commit with an amend:
    git commit --amend
    
    This will open your default text editor. Look for the Author: and Committer: lines, and add a space between your email's closing angle bracket and the date. For example:

    Author: Luca luca@example.com Thu Jan 18 14:30:00 2024 +0100

  • If you just want to set the date to the current time instead of keeping the epoch placeholder, you can skip manual editing and run:
    git commit --amend --date="$(date -R)"
    
  • After saving the changes, run git fsck again to confirm the error is gone.

2. If the bad commit is buried in your history

  • Use interactive rebase to edit the problematic commit:
    git rebase -i HEAD~3  # Replace 3 with how many commits back the bad one is
    
  • In the editor that pops up, find the line for commit 1e39456 and change pick to edit. Save and close the editor.
  • Git will pause at that bad commit. Now run the amend command to fix the date/author format:
    git commit --amend --date="$(date -R)"
    
  • Continue the rebase process with:
    git rebase --continue
    
  • Once done, run git fsck to verify the issue is resolved.

3. Prevent this from happening again

  • Before re-running the Git LFS migrate, double-check your Git user config is set correctly:
    git config user.name
    git config user.email
    
    If either command returns nothing, set them with:
    git config --global user.name "Your Full Name"
    git config --global user.email "your.email@example.com"
    
  • If you had to reset the bad commit first (using git reset --hard HEAD~1), re-run the migrate command:
    git lfs migrate import --no-rewrite luca/models/weights/yolov5m.pt
    
    This should generate a properly formatted commit this time around.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 07:31:14