From 1152575ea4072626bf94fca44101f4dac313eac1 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sat, 5 Sep 2026 18:30:51 -0500 Subject: [PATCH] docs(tools): document tea login prompts and NixOS read-only git config error - Add breakdown of tea login add interactive prompts - Document exit status 255 cause when Git attempts to lock read-only ~/.config/git/config symlinked into /nix/store - Provide resolutions for SSH workflows and declarative Home Manager extraConfig --- knowledge/tools/tea.md | 48 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/knowledge/tools/tea.md b/knowledge/tools/tea.md index b849204..c8cb1a8 100644 --- a/knowledge/tools/tea.md +++ b/knowledge/tools/tea.md @@ -16,12 +16,17 @@ tea login add ``` **Prompts:** -* **URL**: `https://gitea.roadtotech.me` -* **Name**: `roadtotech` (or `main`) +* **URL of Gitea instance**: `https://gitea.roadtotech.me` +* **Name of new Login**: `roadtotech` (or your username / instance alias) +* **Login with**: `token` * **Token**: Generate an access token via Gitea Web UI: - Navigate to **Settings** $\rightarrow$ **Applications** $\rightarrow$ **Generate New Token**. - Select scopes: `repo`, `issue`, `user`, `package`. -* **Insecure**: `false` (valid HTTPS certificate via Traefik). +* **Set Optional settings**: `true` +* **SSH Key Path**: Leave empty for auto-discovery (e.g., `~/.ssh/id_ed25519`). +* **Allow Insecure connections**: `false` (valid HTTPS certificate via Traefik). +* **Add git helper**: `false` on NixOS (see gotcha below) or `true` if your Git config is mutable. +* **Check version of Gitea instance**: `true`. ### 2. Verify Authentication ```bash @@ -32,9 +37,44 @@ tea login list tea whoami # Set default instance if you manage multiple -tea login default roadtotech +tea login default ``` +### 3. NixOS / Home Manager Gotcha: `exit status 255` (Read-only Git Config) + +#### The Error +When setting `Add git helper: true` during `tea login add`, you may see: +```text +Login as on https:// successful. Added this login as +Error: error adding login: git config --global credential.https://.helper, error: exit status 255 +``` + +#### Why It Happens +`tea` attempts to register itself as a Git credential helper by executing: +```bash +git config --global credential.https://.helper ... +``` +On **NixOS** where Git is managed declaratively via Home Manager, `~/.config/git/config` is a symlink pointing to an immutable file in the `/nix/store`: +```text +~/.config/git/config -> /nix/store/...-home-manager-files/.config/git/config +``` +Because the `/nix/store` is read-only, Git fails to acquire a write lock (`error: could not lock config file ... Read-only file system`) and exits with code `255`. + +#### Key Takeaways & Resolution +1. **The login itself still succeeded:** `tea` stores its own configuration in `$XDG_CONFIG_HOME/tea/config.yml` (writable user space). You can verify this immediately with `tea login list`. +2. **If you authenticate Git operations via SSH (Recommended):** You do not need the HTTPS Git credential helper. Select `Add git helper: false` during setup (or ignore the exit status 255 error). +3. **If you want Git to use `tea` for HTTPS operations:** Declare the credential helper in your Home Manager configuration instead of letting `tea` mutate it at runtime: + ```nix + programs.git = { + enable = true; + extraConfig = { + "credential \"https://gitea.roadtotech.me\"" = { + helper = "tea login helper"; + }; + }; + }; + ``` + --- ## 🔄 `gh` vs `tea` Rosetta Stone