把 GitHub 依赖迁移到内网 GitLab 的踩坑总结

背景 公司内网环境极差,外网访问几乎不可达,打包机几乎拉不到 GitHub 上的依赖,所以才把一部分依赖镜像到内网 GitLab,供打包机使用。加上部分仓库很大(如 Alamofire、lottie-ios),迁移过程中集中爆发了一批问题。 补充两点前置配置经验: 如果仓库是 Private 的,外部匿名拉取(不携带 token、cookie 等)会失败。需要在 General Settings - Visibility, project features, permissions - Package registry 下打开 Allow anyone to pull from Package Registry; 往 Pod Spec 仓库推送代码,需要 Maintainer 权限的账号,否则无法 push。 对于超大仓库,在网络环境差的情况下 git push --mirror 很容易出现 504 错误,只推我们用到的 tag 即可。 本次迁移踩坑总结 1. Shallow clone 无法推送 Tag GitLab 报 shallow update not allowed,需要先 git fetch --unshallow,再推送标签。 2. Git LFS 对象缺失 GitLab 会拒绝推送并提示 LFS objects are missing,必须同步并执行 git lfs push --all。 ...

October 12, 2026