diff --git a/engine.go b/engine.go index 6d8d4ab..2c853da 100644 --- a/engine.go +++ b/engine.go @@ -446,8 +446,7 @@ func (e *Engine) setOK(s *repoState, detail string) { } // ensureRemotes 把配置中的远程同步到仓库(缺失则添加,URL 变化则更新) -func (e *Engine) ensureRemotes(s *repoState, cfg *RepoConfig) { - for _, r := range cfg.Remotes { +func (e *Engine) ensureRemotes(s *repoState, cfg *RepoConfig) { for _, r := range cfg.Remotes { out, err := gitRun(cfg.RepoPath, 15*time.Second, "remote", "get-url", r.Name) if err != nil { if _, aerr := gitRun(cfg.RepoPath, 15*time.Second, "remote", "add", r.Name, r.URL); aerr != nil { diff --git a/logs/git-auto-sync.log b/logs/git-auto-sync.log index 397f5c0..8eb2e85 100644 --- a/logs/git-auto-sync.log +++ b/logs/git-auto-sync.log @@ -52,3 +52,10 @@ error: failed to push some refs to 'https://git.shiroko.one/tamakyi/github-auto- [2026-09-08 17:24:34] === 同步完成(本地领先 0,落后 0)=== [2026-09-08 17:25:34] === 开始同步(定时检查,模式 push)=== [2026-09-08 17:25:42] 检测到 3 个未提交改动,执行自动提交 +[2026-09-08 17:25:46] 自动提交完成,将随本轮同步推送 +[2026-09-08 17:25:48] 远程分支 origin/main 不存在(远程仓库可能为空或分支名不一致),将推送本地 8 个提交以建立远程分支 +[2026-09-08 17:25:49] 推送至 origin 失败: error: src refspec main does not match any +error: failed to push some refs to 'https://git.shiroko.one/tamakyi/github-auto-sync-golang' +[2026-09-08 17:25:50] === 同步完成(本地领先 0,落后 0)=== +[2026-09-08 17:26:50] === 开始同步(定时检查,模式 push)=== +[2026-09-08 17:26:58] 检测到 3 个未提交改动,执行自动提交 diff --git a/stats/git-auto-sync.csv b/stats/git-auto-sync.csv index 1406aa7..a1ac041 100644 --- a/stats/git-auto-sync.csv +++ b/stats/git-auto-sync.csv @@ -6,3 +6,4 @@ timestamp,action,result,commits 2026-09-08 17:21:58,push,failed,5 2026-09-08 17:23:16,push,failed,6 2026-09-08 17:24:33,push,failed,7 +2026-09-08 17:25:49,push,failed,8