SVN 完全支援外網訪問,但需解決公網穿透、加密傳輸、權限控制三大問題。現代團隊建議直接遷移 Git。
方案一:SVN + 公網部署(傳統)
- 服務端(一台有公網 IP 的機器)安裝 VisualSVN Server / Apache + mod_dav_svn。
- 配置 HTTPS(Let's Encrypt 免費證書),強制加密。
- 建立倉庫、用戶組、權限(`authz` 檔案)。
- 客戶端 TortoiseSVN / 命令列 `svn checkout https://svn.example.com/repo`。
- 若無公網 IP:用 **frp / ngrok / ZeroTier** 內網穿透映射 443/8443 端口。
方案二:Git + 托管平台(推薦,零運維)
- 註冊 GitHub / GitLab / Gitee / Coding 私有倉庫。
- 本地 `git clone git@github.com:user/repo.git`,SSH 金鑰免密。
- 分支策略:`main`/`develop`/`feature/*`,PR/MR 代碼審查。
- CI/CD 一體化(GitHub Actions / GitLab CI),推送即構建部署。
遷移腳本(SVN → Git)
# 安裝 git-svn
git svn clone --stdlayout --authors-file=authors.txt https://svn.example.com/repo
cd repo
git remote add origin git@github.com:user/repo.git
git push -u origin --all
git push origin --tags
結論:SVN 外網可行但維護成本高(SSL、備份、權限、穿透),Git + 雲端托管是 2024+ 的標準答案。