docs: 合集加入分类方案与Gitea镜像同步方案,收录astryx
This commit is contained in:
1 parent
5ae4635a91
commit
29f4d88d3f
4 files changed
+156
-25
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# 代码库镜像同步脚本(GitHub 外部仓库 -> git.vanusys.com 内部镜像)
|
||||
# 用法:
|
||||
# 1. 按下方 $Mirrors 表登记镜像(镜像工作区目录 + 内部镜像地址)
|
||||
# 2. 首次:git clone --mirror <上游> <工作区目录>
|
||||
# 3. 之后:本脚本 fetch 上游并 push --mirror 到内部
|
||||
# 建议配合 Windows 任务计划程序每日/每周运行;也可移植到香港服务器 cron。
|
||||
# 注意:统一使用 openssl TLS 后端,规避 schannel 在本机受限环境的问题。
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# 镜像登记表:Name -> @{ Upstream = 上游地址; Mirror = 内部镜像地址; Workspace = 本地裸仓库路径 }
|
||||
$Mirrors = @{
|
||||
'astryx' = @{
|
||||
Upstream = 'https://github.com/facebook/astryx'
|
||||
Mirror = 'https://git.vanusys.com/VanuSystems/facebook-astryx.git'
|
||||
Workspace = 'C:\Users\VanuSystems-Mu\Documents\AI\服务器运维\mirrors\astryx.git'
|
||||
}
|
||||
}
|
||||
|
||||
$GlobalSsl = @('-c', 'http.sslBackend=openssl')
|
||||
|
||||
foreach ($name in $Mirrors.Keys | Sort-Object) {
|
||||
$m = $Mirrors[$name]
|
||||
Write-Host "=== 同步 $name ==="
|
||||
if (-not (Test-Path $m.Workspace)) {
|
||||
Write-Warning "镜像工作区不存在: $($m.Workspace),跳过(请先 git clone --mirror)"
|
||||
continue
|
||||
}
|
||||
Push-Location $m.Workspace
|
||||
try {
|
||||
Write-Host "[1/2] 从上游 fetch ..."
|
||||
& git @GlobalSsl fetch --prune origin '+refs/*:refs/*'
|
||||
if ($LASTEXITCODE -ne 0) { throw "fetch 失败: $name" }
|
||||
Write-Host "[2/2] push 到内部镜像 ..."
|
||||
& git @GlobalSsl push --mirror $m.Mirror
|
||||
if ($LASTEXITCODE -ne 0) { throw "push 失败: $name" }
|
||||
Write-Host "OK: $name"
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
Write-Host "全部镜像同步完成。"
|
||||
Reference in new issue
Block a user