Nexora GitLab 远程同步

2026-04-20 重大变更git.xipugold.com 已废弃,Nexora 内部 GitLabgitlab.nexora.restry.cn / 192.168.1.235:3000)成为唯一代码来源(single source of truth)。本页原记录的”远程 → 本地”上游拉取机制已不再运行,保留以备历史参考。

当前状态(2026-04-20 起)

  • 唯一真相源gitlab.nexora.restry.cn(即 192.168.1.235:3000,Web;git+ssh 走 2222 端口)
  • 已废弃git.xipugold.com,不再拉取、不再对齐
  • 所有项目代理(nexora-pyerp / xipu / mazu / laiya / small / ops / docs / main)已被 eagle 通过 Clawline 广播通知:本地 origin 如仍指向 git.xipugold.com/*,立即切换到 gitlab.nexora.restry.cn/xipugold/* 对应仓库;后续所有 clone / pull / push / CI 流水线全部以内部 GitLab 为准;每个代理需把该事实写入 MEMORY.md 长期记忆
  • 分支保护(main)、CI runners、账号体系仍由 nexora-ops 维护

2026-05-07 root PAT 入门神 + nexora-vendor 组接 nexora-loop

为了让 fries-mac 这类外部 agent 也能直接通过 API 建库 / 推送,签发 root 用户的 Personal Access Token(severity=high,有效期 1 年至 2027-05-07),scope 含 api, read_api, read_user, read_repository, write_repository, sudo, admin_mode —— 等同于完整 API 管理权(建库 / 建组 / 看所有组织 / impersonate 任意用户)。

凭据全部入门神 vault namespace gitlab-nexora/

key
gitlab-nexora/BASE_URLhttps://gitlab.nexora.restry.cn
gitlab-nexora/USERNAMEroot
gitlab-nexora/ROOT_PATPAT,severity=high,2027-05-07 过期
gitlab-nexora/SSH_PORT2222

⚠️ 不要gitlab-nexora/ROOT_PAT 跨 vault namespace 复用;nexora-loop 系内的所有项目共用 gitlab-nexora/* 命名空间。

新接入项目(nexora-loop)放到 nexora-vendor/ group(project id 40,private),本地双 push remote:

[remote "origin"]
    url    = git@github.com:Restry/nexora-loop.git
    fetch  = +refs/heads/*:refs/remotes/origin/*
    pushurl = git@github.com:Restry/nexora-loop.git
    pushurl = ssh://git@gitlab.nexora.restry.cn:2222/nexora-vendor/nexora-loop.git

git push 一条命令同时推 GitHub + GitLab。本机 Hermes mask 层会把 [email protected] 字面替换 —— 配 remote 用 ssh://git@host:port/... 形式或在 vault 里取,避免被 mask 吞掉 URL。

历史:镜像同步流程(2026-04-09 ~ 04-16,已停用)

在决定以内部 GitLab 为唯一源之前,每个仓库配置双 remote 做单向镜像:

  • origin → 本地 GitLab(192.168.1.235:3000),日常开发推拉
  • upstream → 远程 GitLab(git.xipugold.com),定期拉取上游更新

同步流程:git fetch upstreamgit merge upstream/maingit push origin;认证因远程 OAuth2 token 过期,后期改用 dora 账号密码。

同步结果

共涉及约 30 个仓库的同步管理:

状态首次同步 (04-09)二次同步 (04-11)
✅ 已同步/已最新26 个25 个
🔄 有新代码2 个(app_xiao_shou_kotlin +1, sprin-boot-kotlin219 +4)3 个(pyerp_php +3, pyerp_web +4, hjhs +5)
⏭️ 跳过4 个(无 upstream)
⚠️ 失败1 个(wl_php 超时)

常见问题

main 分支保护

本地 GitLab 的 main 分支默认开启保护,阻止强制推送。需临时解除保护 → 推送 → 恢复保护。首次同步时有 3 个仓库遇到此问题。

OAuth2 Token 过期

远程 GitLab 的 OAuth2 token 会过期,导致 git fetch upstream 认证失败。解决方案:改用账号密码认证(dora 账号)。

Unrelated Histories

hjhs 仓库因初始 import commit 与远程 clone 的 commit 历史不一致,需要 git merge --allow-unrelated-histories 强制合并。

wl_php 超时

wl_php 仓库在远程 fetch 时持续超时断开,疑似包含超大文件或仓库体积过大,未能成功同步。

相关页面

  • nexora — 平台总览
  • nexora — Nexora Bot (运维管家)

2026-04-12 更新

  • 修复了 29 个仓库的 upstream URL(大部分还是旧 OAuth2 token),批量改为密码认证方式
  • 同步结果:pyerp_php +2 commits(门店订单/会员类型)、pyerp_web +2 commits(结价管理UI),其余无变化
  • 确认 cron 每天凌晨 3 点自动同步仍在正常运行
  • Docker volume 挂载实现代码同步即开发环境自动更新