chore: git_push_dlp 改 robocopy 增量镜像(固定 stage 复用,只复制变动文件)

This commit is contained in:
p40000043244@byd.com
2026-07-31 18:13:44 +08:00
parent e0f1db75c2
commit a458270fa7
2 changed files with 26 additions and 23 deletions
+8 -7
View File
@@ -20,11 +20,12 @@ fatal: not a git repository (or any of the parent directories): .git
## 原理
1. `xcopy .git``%TEMP%\git_push_dlp\<repo>-<random>\`(保护区外,授权进程
读出明文,写出不再加密)。默认通过 `/EXCLUDE` 排除 `.git\lfs`LFS 对象
缓存,动辄数 GB,普通提交 push 不需要)。
1. `robocopy /MIR .git`固定 stage 目录 `%TEMP%\git_push_dlp\<repo>\`(保护区外,
授权进程读出明文,写出不再加密)。stage 目录跨运行保留:首次全量镜像,
之后每次 push 只复制变动的文件。默认通过 `/XD lfs` 排除 `.git\lfs`LFS
对象缓存,动辄数 GB,普通提交 push 不需要)。
2. 在 stage 副本里执行 `git push`
3. 回到原仓库 `git fetch` 同步远程跟踪引用,然后删除 stage
3. 回到原仓库 `git fetch` 同步远程跟踪引用。stage 目录保留不删,供下次增量复用
## 使用方法
@@ -45,9 +46,9 @@ set GIT_PUSH_DLP_WITH_LFS=1
## 排障
- **`[ERROR] xcopy .git failed. Insufficient disk space`**TEMP 所在盘空间不足。
先清理 `%TEMP%\git_push_dlp\` 下历史失败残留的 `TestHub-*` 目录(脚本在
xcopy 失败时不会自动清理)。仍不足时确认是否误设了
- **`[ERROR] robocopy .git failed`**常见于 TEMP 所在盘空间不足。stage 目录
跨运行复用(`%TEMP%\git_push_dlp\<repo>\`),旧版本脚本留下的 `<repo>-<数字>`
残留目录可以整体删除。仍不足时确认是否误设了
`GIT_PUSH_DLP_WITH_LFS`(全量 lfs 可能超过盘符剩余空间)。
- **stage 在 E: 盘也报 128**:整个 E: 盘都在 DLP 拦截范围内,stage 必须落在
C:`%TEMP%` 默认位置),不要把 `TEMP` 指到 E:。