Background
The feiCode platform hosts over 455 GitHub mirror repositories. Historically, multiple third-party proxies were used; now, all mirrors uniformly use the platform’s self-hosted proxy: gh.wpcy.net.
Key Point: Mirror URLs Are Stored in Two Tables
This is the most commonly overlooked pitfall — Forgejo mirror URLs are not stored in just one location:
| Table | Field | Purpose |
|---|---|---|
repository |
original_url |
Source URL displayed in the Web UI |
mirror |
remote_address |
Actual pull address (used during synchronization) |
If you only update repository.original_url, the Web UI will appear correct, but synchronization will still use the old address — and vice versa. Both fields must be updated.
Procedure
1. Access the Database
docker exec -it <container-name> sqlite3 /data/gitea/forgejo.db ".timeout 5000"
.timeout 5000prevents SQLite lock conflicts while Forgejo is running.
2. Check Current Proxy Distribution
-- Inspect the `mirror` table (actual pull addresses)
SELECT CASE
WHEN remote_address LIKE '%gh.wpcy.net%' THEN 'gh.wpcy.net'
WHEN remote_address LIKE '%old-proxy%' THEN 'old-proxy'
ELSE remote_address
END AS proxy, COUNT(*) AS cnt
FROM mirror GROUP BY proxy ORDER BY cnt DESC;
3. Replace Proxy Addresses (Update Both Tables)
-- Replace third-party proxy domains
UPDATE mirror SET remote_address = REPLACE(remote_address, 'old-proxy-domain', 'gh.wpcy.net')
WHERE remote_address LIKE '%old-proxy-domain%';
UPDATE repository SET original_url = REPLACE(original_url, 'old-proxy-domain', 'gh.wpcy.net')
WHERE original_url LIKE '%old-proxy-domain%';
-- Prepend proxy for direct github.com URLs
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. Verification
SELECT remote_address FROM mirror
WHERE remote_address LIKE '%github.com%'
AND remote_address NOT LIKE '%gh.wpcy.net%';
-- Should return no results
Important Notes
- Avoid
jq file > file: it truncates the file. Instead, usejq file > tmp && mv tmp file. - When executing remotely via SSH, use a heredoc to avoid quoting issues.
- Private repository URLs containing authentication (e.g., those with
@) require special handling — inspect for addresses containing@. - All newly created mirrors should follow this format:
https://gh.wpcy.net/https://github.com/org/repo.git. - Always add
.timeoutbefore SQLite operations to prevent lock conflicts with a running Forgejo instance.
Historical Proxies (All Migrated)
ghproxy.net, hk.gh-proxy.com, gh.llkk.cc, git.yylx.win, fast.feibisi.com, and direct github.com access.