D:\source\openclaw是github开源项目目录,
D:\source\m-openclaw是gitee项目目录,
我之前把github项目的main分支和tags同步到了gitee项目过一次,现在需要再同步一次,请告诉我如何操作
情况清楚了。两个独立仓库,同步步骤如下:
方案:从 GitHub 拉取,推送到 Gitee
步骤1:在 GitHub 仓库目录拉取最新内容
powershell
cd D:\source\openclaw
git fetch origin
git pull origin main
步骤2:进入 Gitee 仓库,添加 GitHub 为上游(如果还没有)
powershell
cd D:\source\m-openclaw
git remote add upstream git@github.com:openclaw/openclaw.git
如果之前已经加过了,跳过这步(会报 "already exists")
步骤3:从 GitHub 拉取最新代码和 tags
powershell
git fetch upstream
git fetch upstream --tags
步骤4:同步 main 分支
powershell
git checkout main
git merge upstream/main
# 或者强制覆盖(如果 Gitee 仓库没有独立改动):
# git reset --hard upstream/main
步骤5:推送到 Gitee(含 tags)
powershell
git push origin main
git push origin --tags
也可以一步到位(如果 Gitee 没有独立改动)
直接在 Gitee 仓库目录执行:
powershell
cd D:\source\m-openclaw
git fetch upstream
git fetch upstream --tags
git checkout main
git reset --hard upstream/main
git push origin main --force
git push origin --tags