---
canonical: https://meta.cyberforums.com/t/feicode/1858
webpage: https://wpcy.com/community/t/1858-feicode
language: zh-Hans
---

# feiCode 镜像代理统一维护手册

> 文派叶子支持论坛的只读副本，本页不能回复。
> 讨论原文：https://meta.cyberforums.com/t/feicode/1858
> 网页版：https://wpcy.com/community/t/1858-feicode

## 1 · devops

- 发布时间：2026年3月8日 01:49

背景
feiCode 平台有 455+ 个 GitHub 镜像仓库，历史上使用了多种第三方代理，现在统一使用自有代理 gh.wpcy.net。
关键：镜像地址存两个表
这是最容易漏的坑——Forgejo 镜像 URL 不是只存一个地方：




表
字段
用途




repository
original_url
Web UI 显示的来源标记


mirror
remote_address
实际拉取地址（同步时用这个）



如果只改了 repository.original_url，Web UI 看起来是对的，但同步还是走老地址。反过来也一样。两个都要改。
操作步骤
1. 进入数据库
docker exec -it <容器名> sqlite3 /data/gitea/forgejo.db ".timeout 5000"


.timeout 5000 防止 Forgejo 运行时的 SQLite 锁冲突。

2. 查看当前分布
-- 检查 mirror 表（实际拉取地址）
SELECT CASE
  WHEN remote_address LIKE '%gh.wpcy.net%' THEN 'gh.wpcy.net'
  WHEN remote_address LIKE '%旧代理%' THEN '旧代理'
  ELSE remote_address
END AS proxy, COUNT(*) AS cnt
FROM mirror GROUP BY proxy ORDER BY cnt DESC;

3. 替换代理地址（两个表都要改）
-- 替换第三方代理
UPDATE mirror SET remote_address = REPLACE(remote_address, '旧代理域名', 'gh.wpcy.net')
  WHERE remote_address LIKE '%旧代理域名%';
UPDATE repository SET original_url = REPLACE(original_url, '旧代理域名', 'gh.wpcy.net')
  WHERE original_url LIKE '%旧代理域名%';

-- 直连 github.com 的，前置代理
UPDATE mirror SET remote_address = 'https://gh.wpcy.net/' || remote_address
  WHERE remote_address LIKE 'https://github.com/%';
UPDATE repository SET original_url = 'https://gh.wpcy.net/' || original_url
  WHERE original_url LIKE 'https://github.com/%';

4. 验证
SELECT remote_address FROM mirror
  WHERE remote_address LIKE '%github.com%'
  AND remote_address NOT LIKE '%gh.wpcy.net%';
-- 应无结果

注意事项

别用 jq file > file：会清空文件，用 jq file > tmp && mv tmp file
SSH 远程执行用 heredoc 避免引号问题
有认证信息的私有仓库 URL 需单独处理（检查含 @ 符号的地址）
新建镜像统一用格式: https://gh.wpcy.net/https://github.com/org/repo.git
SQLite 操作需加 .timeout 防止运行中的 Forgejo 锁冲突

历史代理清单（已全部迁移）
ghproxy.net, hk.gh-proxy.com, gh.llkk.cc, git.yylx.win, fast.feibisi.com, 以及直连 github.com 的。
