forgejo-cli-ops
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseScope
适用范围
- Authenticate to a Forgejo host and verify access.
- Run common issue/PR/repo commands with the correct host.
- Troubleshoot host and login mismatches.
- 登录Forgejo主机并验证访问权限。
- 使用正确的主机运行常见的议题/拉取请求/仓库命令。
- 排查主机与登录不匹配的问题。
Prerequisites
前提条件
- A Forgejo Personal Access Token (PAT) created in the Forgejo web UI.
- installed and available in PATH.
fj - Optional: (GNOME Keyring) for secure token storage.
secret-tool
- 在Forgejo网页界面中创建的Forgejo个人访问令牌(PAT)。
- 已安装并可在PATH中访问。
fj - 可选:(GNOME密钥环)用于安全存储令牌。
secret-tool
Host usage (important)
主机使用方式(重要)
-H/--hostbash
fj -H <FORGEJO_HOST> repo view <owner>/<repo>To avoid repeating the host, set :
FJ_HOSTbash
export FJ_HOST=<FORGEJO_HOST>-H/--hostbash
fj -H <FORGEJO_HOST> repo view <owner>/<repo>为避免重复输入主机,可设置环境变量:
FJ_HOSTbash
export FJ_HOST=<FORGEJO_HOST>Authentication (secret-tool example)
身份验证(secret-tool示例)
Store your token (one-time) and register with fj:
bash
echo -n "<PAT_VALUE>" | secret-tool store --label="Forgejo PAT" service forgejo user <username>@<FORGEJO_HOST>
echo -n "$(secret-tool lookup service forgejo user <username>@<FORGEJO_HOST>)" | fj -H <FORGEJO_HOST> auth add-key <username>Verify:
bash
fj -H <FORGEJO_HOST> auth list
fj -H <FORGEJO_HOST> whoami一次性存储令牌并在fj中注册:
bash
echo -n "<PAT_VALUE>" | secret-tool store --label="Forgejo PAT" service forgejo user <username>@<FORGEJO_HOST>
echo -n "$(secret-tool lookup service forgejo user <username>@<FORGEJO_HOST>)" | fj -H <FORGEJO_HOST> auth add-key <username>验证:
bash
fj -H <FORGEJO_HOST> auth list
fj -H <FORGEJO_HOST> whoamiCleanup
清理操作
bash
fj auth logout <FORGEJO_HOST>
secret-tool clear service forgejo user <username>@<FORGEJO_HOST>bash
fj auth logout <FORGEJO_HOST>
secret-tool clear service forgejo user <username>@<FORGEJO_HOST>Troubleshooting
故障排查
- often means the host defaulted to github.com; add
Error: not logged inor set-H.FJ_HOST - If returns nothing, unlock your keyring or confirm the stored user/host key.
secret-tool lookup
- 若出现错误,通常意味着主机默认设为github.com;请添加
Error: not logged in选项或设置-H环境变量。FJ_HOST - 若无返回结果,请解锁密钥环或确认存储的用户/主机密钥是否正确。
secret-tool lookup