# 外網 Git、Access 與 PAT

核對日期：2026-10-02
引用網址：https://mcp.republic-of-engineers.com/guides/git-access/

外網 Git 需要通過 Cloudflare Access，並使用 Forgejo 個人存取權杖 PAT 作原生 Git 認證；兩者用途不同。

## 使用前提

安裝 Git、Python 3 與 cloudflared，確認已取得儲存庫權限。先登入 Forgejo，依個人設定管理 PAT，透過系統 credential helper 保存。

## 操作步驟

1. 從有權限的儲存庫取得 scripts/roe-git，依會員開發指南使用。
2. 透過 helper clone：python3 roe-git --origin https://code.republic-of-engineers.com -- clone https://code.republic-of-engineers.com/roe-admin/batteryhub.git
3. 依瀏覽器提示完成 Access；Git 詢問密碼時使用 PAT。
4. 推送自己的功能分支，遇到 403／404 先核對入口、會員狀態與 repo 權限。

## 限制

不要把 PAT 放進 remote URL、命令範例或聊天。網頁 OTP 不是 PAT。此指南不是你本人外網 Git 已驗收的證明。
