Unity - Package Manager - Import a private package from GitHub repository
Quick Chat
Unity Package Manager (UPM) 支援從 Git repository 直接安裝與管理 package,這對於團隊開發和共享自定義 package 非常有用。
- ⚠️ 如果是 organization 協同,需開啟相關的成員權限。
- ⚠️ Using private repositories with HTTPS Git URLs,提到的 Git Credential Manager 似乎不起作用。
Solution 1 - SSH (建議)
- ⚠️ 需確保 SSH Key 已添加到 GitHub。
Solution 2 - Personal Access Token
- ⚠️ 建議使用較客製化的 Fine-Grained Token
- ⚠️ Resource owner 要注意(如果有多個身分)
Guide
Steps
- 至 GitHub «帳戶設定»(非儲存庫設定)
- Developer Settings -> Personal Access Tokens -> Fine-Grained Tokens
- 生成 Token (Read-Only Permission for the repo Content).
"com.yourusername.yourpackage": "git+https://x-oauth-basic:<token>@<repo>?path=<folder>"