Skip to content

Authentication and Profiles zh TW

KoukeNeko edited this page Sep 9, 2026 · 3 revisions

Authentication and Profiles

English · 繁體中文

互動登入

要求 username 與不回顯的 password,成功後把 token 存入作業系統 keyring:

taiga auth login \
  --host https://taiga.example.com/taiga/ \
  --profile company

--host 指向 Taiga frontend,CLI 會讀取它的 conf.json 找出真正的 API base URL,因此部署在 /taiga/ 這類子路徑的站台也能自動發現。若你已經知道 API URL,可以改用 --api-url 直接指定;兩者互斥。

互動登入需要 TTY。在 CI 或任何非互動環境請改用 token 登入。

以既有 token 登入

printf '%s\n' "$TOKEN" |
  taiga auth login \
    --api-url https://taiga.example.com/taiga/api/v1/ \
    --profile company \
    --with-token

CLI 會用這個 token 呼叫 users/me 驗證後才寫入 keyring。SSO 或 LDAP 站台沒有通用的互動登入流程,但只要 站台允許,就可以用這個方式匯入既有 token。

狀態與登出

taiga auth status
taiga auth status --json
taiga auth logout

logout 只刪除目前 profile 對應的 keyring 項目,不會動到設定檔中的 API URL 與預設專案。

Token 來源優先序

  1. TAIGA_TOKEN 環境變數
  2. OS keyring 中 profile|api_url 對應的項目

keyring 的 key 同時包含 profile 與 API URL,所以同一個 profile 換到別的站台不會誤用舊 token。Token 永遠 不會寫進設定檔。

Profile

設定檔位於作業系統的使用者設定目錄:

current_profile = "company"

[profiles.company]
api_url = "https://taiga.example.com/taiga/api/v1/"
project = "example-project"
taiga config list
taiga config list --json
taiga config set profile company
taiga config set api-url https://taiga.example.com/taiga/api/v1/
taiga config set project example-project

Profile 名稱只接受英數字與 -、_、.。

設定優先序

command flag
→ TAIGA_PROFILE / TAIGA_API_URL / TAIGA_PROJECT / TAIGA_TOKEN
→ Git-local taiga.profile / taiga.project
→ current profile
→ safe defaults

綁定單一 Git repository

把 profile 與 project 限定在目前的 repository:

taiga project use example-project --local
taiga config set project example-project --local
taiga config list --local

這些值寫進 .git/config 的 taiga.profile 與 taiga.project,屬於 repository 的本機設定,不會被 commit, 也不會影響其他目錄。不在 Git repository 中時,--local 會明確回報錯誤而不是靜默忽略。

Clone this wiki locally