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

Git远程仓库多pushurl配置:遇离线节点如何继续推送?

解决Git多PushURL遇离线节点中断的问题

你当前遇到的问题是Git默认在推送至多PushURL时,只要其中一个节点推送失败就会终止后续操作。要实现忽略错误继续推送剩余节点,有两种可行方案:

方案1:临时使用命令行参数

每次推送时添加--continue-on-error参数,强制Git在遇到错误后继续处理剩余PushURL:

git push --continue-on-error origin

方案2:配置永久生效规则

如果不想每次推送都手动加参数,可将该规则配置到当前仓库或全局:

# 仅当前仓库生效
git config push.continueOnError true

# 全局所有仓库生效
git config --global push.continueOnError true

低版本Git兼容方案

上述push.continueOnError特性要求Git版本在2.30.0及以上。如果你的Git版本偏低,可将每个节点单独配置为独立远程仓库,再通过脚本批量推送:

  1. 逐个添加远程仓库:
git remote add system1 ssh://user@system1.com/home/user/repo/source
git remote add system2 ssh://user@system2.com/home/user/repo/source
git remote add system3 ssh://user@system3.com/home/user/repo/source
git remote add system4 ssh://user@system4.com/home/user/repo/source
git remote add system5 ssh://user@system5.com/home/user/repo/source
  1. 编写批量推送脚本(保存为push-all.sh):
#!/bin/bash
for remote in system1 system2 system3 system4 system5; do
    git push $remote || echo "推送$remote失败,继续下一个节点"
done
  1. 给脚本添加执行权限并运行:
chmod +x push-all.sh
./push-all.sh

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.15 22:03:19