Repository navigation
How Sign In Prompts Work
This chapter explains how git's and ssh's questions (a username, a password, an SSH passphrase, a new host key) reach a dialog in the app. The user side is in Sign-In Prompts; running git is in Backend.
Writes go through the git CLI (git/cli.rs), with GIT_TERMINAL_PROMPT=0 so git never waits for a terminal the app does not have. A remote that asked for a login therefore failed at once, and the user saw "could not read Username ... terminal prompts disabled" in a toast, with no way to answer. The user asked for a popup that asks what git needs.
Git and ssh both support an askpass program: when they need an answer and have no terminal, they run the program named in GIT_ASKPASS or SSH_ASKPASS with the prompt as its only argument and read the answer from its stdout. Our own executable is that program.
sequenceDiagram
participant G as git or ssh
participant C as nibtree (askpass client)
participant S as App: askpass.rs server
participant W as Window: AskpassDialog
G->>C: run with prompt "Username for 'https://github.com': "
C->>S: JSON line: token, prompt, repo path (127.0.0.1)
S->>W: event askpass-request (id, prompt, repoPath)
W->>S: askpass_respond(id, answer)
S->>C: JSON line: answer
S-->>W: event askpass-done (other windows close it)
C->>G: answer on stdout, exit 0 (exit 1 when cancelled)
-
installtakes the hooks that show a question (commands/askpass.rs):asksendsaskpass-requestto the windows showing the repository throughemit_for_path(every window when none does), anddonesendsaskpass-doneto all. - The first command that may ask starts a listener on a random loopback port with a random token (
getrandom). Each connection carries one JSON line; a wrong token gets no answer. -
ask_userregisters a channel under a new id, callsask, and waits up to five minutes.askpass_respondfrom the page sends the answer (None for Cancel). -
apply(command, repo_path)setsGIT_ASKPASSandSSH_ASKPASStocurrent_exe(),SSH_ASKPASS_REQUIRE=force(OpenSSH 8.4 and later use askpass without a terminal only then), andGM_ASKPASS_PORT,GM_ASKPASS_TOKENandGM_ASKPASS_REPO.
apply runs in cli::run_streaming_with_env and cancel::run_streaming, the runners of push, pull, fetch, clone, submodule updates and LFS. Background auto fetch uses cli::run_raw, so it never opens a dialog.
lib.rs calls askpass::client_main before anything else. With the two variables set, the executable connects, sends the prompt, prints the answer with a newline (git and ssh read up to it) and exits, before Tauri starts, so no window or Dock icon appears.
askpassPrompt.ts reads the prompt: git's "Username for" and "Password for" (with the host and user), ssh's "Enter passphrase for key", "user@host's password" and the yes/no question about a new host key. Anything else is a generic question, hidden when it mentions a password, token or PIN.
askpass.svelte.ts queues the questions of this window. For a username, AskpassDialog.svelte asks the password too and keeps it in memory for up to a minute: rememberedPassword answers git's following password question for the same host and user without showing a second dialog. The dialog stops key events from reaching window shortcuts and closes on Esc (Cancel).
| File | What it does |
|---|---|
src-tauri/src/askpass.rs |
Client, loopback server, apply, respond
|
src-tauri/src/commands/askpass.rs |
WindowHooks (events) and askpass_respond
|
src-tauri/src/lib.rs |
client_main at start, install in setup
|
src-tauri/src/git/cli.rs, git/cancel.rs
|
apply for commands the user starts |
src/lib/askpass/askpassPrompt.ts |
Reading prompts, remembering the password |
src/lib/askpass/askpass.svelte.ts |
The queue of questions |
src/lib/askpass/AskpassDialog.svelte |
The dialog, mounted once in App.svelte: the UI library's Dialog with urgent, so it shows over any other dialog and window shortcuts never act behind it |
Our executable as the askpass program. A separate helper binary would need its own signing and bundling on every platform. The app binary is already there, and leaving before Tauri starts keeps it quick.
Loopback TCP with a token. It works the same on macOS, Windows and Linux. The token lives only in the environment of the git process, so no other program can ask questions or read answers.
Nothing is stored by us. Git passes the login to the user's credential helper (the macOS keychain, Git Credential Manager), which already handles storage well. The app keeps a typed password only until git's next question, at most a minute.
Only commands the user starts. A login dialog that pops up from a background fetch would be confusing, so auto fetch keeps failing quietly.
-
src-tauri/src/askpass.rs: a prompt is answered through the server, a wrong token gets nothing, a cancelled prompt gets None, andgit credential fillgets its username and password through the same environment and protocol. -
src/lib/askpass/askpassPrompt.test.ts: every prompt shape, and when a remembered password answers. -
askpass-sign-ininscripts/screenshots.tsruns it all against a local server that always answers 401.
- Update this page and Sign-In Prompts when the prompts read, the runners that call
applyor the dialog change. - Retake
askpass-sign-in.png. See Docs and Screenshots.
These pages are generated from docs/wiki. To correct something, open a pull request against the source file; edits made here are overwritten.
Using Nibtree
- Getting Started
- Welcome Screen
- Workspaces
- Files Panel
- File Operations
- File Icons
- Rounded Panels
- Editor and Tabs
- Pin Reorder and Wrap Tabs
- Single Tab Title
- Split Editor
- New File and Unsaved Changes
- Unload Hidden Tabs
- Editing Code
- Code Appearance
- Markdown Editor
- Image and PDF Preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and Replace
- Changes and Commits
- Sign In Prompts
- Commit Box Layout
- Repository Actions
- Commit Options
- Ignoring Files
- Diffs
- Inline Diffs
- Staging View
- Revert a Change
- Resolving Conflicts
- Merge Tool
- Blame
- History and Log
- Merge Commits
- Branches and Tags
- Branches Popup
- Remotes
- Stashes
- Shelf
- Git Menu
- Git Dialogs
- Interactive Rebase
- Worktrees
- AI Agents
- AI Tasks
- AI Usage
- Keep Computer Awake
- Submodules
- Git LFS
- GitHub
- Git Console
- Terminal
- Terminal Features
- Scripts
- Navigation
- Menus
- Settings
- Settings Search
- Color Themes
- Settings Terminal and Automation
- Settings Files
- Updates
- Status Bar and Help
- Notifications
- Memory Use
- Clear Cache
- MCP and CLI
- Git Mergetool
- Keyboard Shortcuts
- Keyboard Shortcuts Editor
- Troubleshooting
- Troubleshooting Git
Developers
- Developer Guide
- Architecture
- Project Layout
- Backend
- How Folder Watching Works
- Folder Watching Bugs We Fixed
- How Workspace Files Work
- How the Preview Scheme Works
- Backend Services
- How Terminal Features Work
- Terminal Bugs We Fixed
- Frontend
- How the Rich Markdown Editor Works
- Rich Markdown Bugs We Fixed
- Git Menu Links
- Menu Keys and Routing
- Frontend Modules
- Blame Bugs We Fixed
- Project Color And Title Bar
- One Diff View
- Diff Bugs We Fixed
- Merge Tool Layouts
- Merge Tool Bugs We Fixed
- Color Theme Bugs We Fixed
- How the Connected Diff Works
- Rounded Panels Bugs We Fixed
- Update Bugs We Fixed
- Status Bar Bugs We Fixed
- MCP and CLI Bugs We Fixed
- Repository Actions Bugs We Fixed
- How the Changes Tab Works
- CodeMirror Patterns
- How the Cursor Works
- How Editor Features Work
- How the Path Bar Works
- Commands and Events
- Settings Reference
- Commands Workspace and Changes
- Commands Branches and Remotes
- Commands History and Extras
- Commands App and Tools
- Testing
- Test Suites
- Debugging
- Debugging with MCP
- Measuring Setting Memory
- How Terminal Memory Is Measured
- How Markdown Diagrams Work
- Releases and CI
- Publishing the Wiki
- Versioning and Changelog
- Browser Version Packages
- Browser Release Checks
- Docker Image
- Platforms and Signing
- Windows Support
- Windows Bugs We Fixed
- Windows MCP and CLI
- Docs and Screenshots
- UI Library
- UI Library MCP
- UI Library Bugs
- UI Library Migration
- Contributing
How features work
- Welcome screen
- Workspaces and folders
- Files panel
- File operations
- File icons
- Editor and tabs
- Pin, reorder and wrap tabs
- Single tab title
- Split editor
- New File and unsaved changes
- Unload hidden tabs
- Editing code
- Code appearance
- Markdown editor
- Image and PDF preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and replace
- Changes and commits
- Sign-in prompts
- Commit box layout
- Repository actions
- Commit options
- Ignoring files
- Diffs
- Inline diffs
- Staging view
- Revert a change
- Resolving conflicts
- Merge tool
- Blame
- History and log
- Merge commits
- Commit tabs
- Branches and tags
- Branches popup
- Remotes
- Stashes
- Shelf
- Git menu
- Git dialogs
- Interactive rebase
- Worktrees
- AI agents
- AI usage
- Keep computer awake
- AI tasks
- Submodules
- Git LFS
- GitHub account
- Git Console
- Back and Forward
- Integrated terminal
- Scripts tool window
- Menu bar
- Settings
- Search in Settings
- Color themes
- Rounded panels
- Updates and release channels
- Status bar and help links
- Notifications
- Memory readout and memory log
- Clear Cache
- MCP server and command line tool
- git mergetool mode