Skip to content

Install Git and the GitHub CLI on a brand-new computer (0.0.95) - #288

Merged
glenn-jocher merged 4 commits into
mainfrom
fresh-computer-git
Nov 10, 2026
Merged

glenn-jocher merged 4 commits into
mainfrom
fresh-computer-git

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

A new user's computer had no Git, so Lite could not work there. Git and the GitHub CLI are the last things a fresh macOS, Windows, or Linux computer lacks after #287.

Git (agents run it on nearly every task; GitHub clones and worktrees need it)

  • Installing any harness first installs Git when it is missing, through each system's own installer, which asks for administrator approval in its own window:
    • macOS: xcode-select --install (Apple's Command Line Tools), then Lite waits up to an hour for xcode-select -p to succeed.
    • Windows: winget install Git.Git. refresh_user_path now reads the Machine PATH as well, so Lite finds the new git without restarting.
    • Linux: pkexec with apt-get, dnf, zypper, or pacman, whichever exists.
  • Git is best-effort for a harness install: if Git fails, the agent still installs, while Cancel stops both. This replaces the Kimi-only Git for Windows step from Install every harness on a brand-new computer (0.0.94) #287.

GitHub CLI

  • "Sign in with GitHub CLI" stopped with "Could not find gh in your PATH". It now calls prepare_github first, which installs Git and then unpacks GitHub's release build of gh (latest tag from the releases API, archive for this OS and architecture) into ~/.local/bin, with no administrator needed. A toast with Cancel appears if setup takes more than half a second.

Shared installer

  • The spawn, stderr capture, and cancel logic moves out of install_agent into run_installer, and the PowerShell/sh wrapper with the curl→wget fallback into installer_shell, so Git, gh, and harness installs share one cancellable path.

Validation (macOS)

  • The exact gh command, run with an empty HOME and PATH=/usr/bin:/bin, installs gh version 2.103.3.
  • The exact Command Line Tools wait loop and Linux package-manager loop, run against fake xcode-select, dnf, and no-manager PATHs, behave as intended.
  • cargo clippy, cargo fmt --check, cargo test, bun run check, and bun test pass.
  • The Windows and Linux branches are compiled by CI and not yet run on a real machine.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Lite now prepares Git before installing an agent and sets up the GitHub CLI before GitHub sign-in, supporting computers where those tools are missing.

📊 Key Changes

  • Added Git setup for macOS via Apple Command Line Tools, Windows via winget, and Linux via pkexec with supported package managers; Git setup is best-effort for agent installs.
  • Added prepare_github, which checks for GitHub CLI and, if missing, downloads the latest release for the current OS and architecture into ~/.local/bin.
  • Moved installer execution, error capture, and cancellation into shared helpers, and serialized installer and GitHub setup runs.
  • Updated Windows PATH refresh to include the Machine PATH and filtered empty PATH entries so they cannot supply a CLI.

🎯 Purpose & Impact

  • A missing Git or GitHub CLI can now be handled as part of agent installation or GitHub sign-in; GitHub setup shows a cancellable loading toast if it takes more than 500 ms.
📋 Skipped 1 file (lock files, generated, images, etc.)
  • src-tauri/Cargo.lock

A new user's computer has no Git: macOS has only a stub until Apple's Command Line
Tools are installed, Windows has none, and Linux leaves it to the package manager.
Agents and GitHub clones need it, and GitHub sign-in needs the GitHub CLI, which
stopped with "Could not find gh in your PATH".

Installing a harness now first installs Git through each system's own installer
(xcode-select, winget, or the package manager through pkexec). GitHub sign-in
installs Git and GitHub's release build of gh into ~/.local/bin. Both run through
the shared cancellable installer, which replaces the Kimi-only Git step.
@UltralyticsAssistant UltralyticsAssistant added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 10, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/lite 🚀 PR! This automated message confirms your contribution was received, and an Ultralytics engineer will assist with the review. To ensure a seamless integration of your work, please review the following checklist:

  • ✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • ✅ Synchronize with Source: Confirm your PR is synchronized with the ultralytics/lite main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • ✅ Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • ✅ Update Documentation: Update the relevant documentation for any new or modified features.
  • ✅ Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • ✅ Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR; the CLA check will comment with signing instructions if needed.
  • ✅ Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Reviewed Git and GitHub CLI installation, cancellation, and PATH handling. The Windows PATH refresh can introduce a current-directory executable lookup when the User PATH is empty; otherwise, no concrete issue found.

💬 Posted 1 inline comment
  • 💡 MEDIUM src-tauri/src/lib.rs:3509 If the Windows User PATH is empty or unset, this concatenation starts with ;. user_path() later splits that PATH, and resolve_executable() checks each entry in order; the empty entry resolves against Lite’s current directory, so a git.exe or provider executable there can run ahead of the Machine PATH entry. Build the refreshed PATH from nonempty values and filter empty components before caching it.
📋 Skipped 1 file (lock files, generated, images, etc.)
  • src-tauri/Cargo.lock

Comment thread src-tauri/src/lib.rs
"-NoProfile",
"-Command",
"[Environment]::GetEnvironmentVariable('Path','User')",
"[Environment]::GetEnvironmentVariable('Path','User') + ';' + [Environment]::GetEnvironmentVariable('Path','Machine')",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 MEDIUM: If the Windows User PATH is empty or unset, this concatenation starts with ;. user_path() later splits that PATH, and resolve_executable() checks each entry in order; the empty entry resolves against Lite’s current directory, so a git.exe or provider executable there can run ahead of the Machine PATH entry. Build the refreshed PATH from nonempty values and filter empty components before caching it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 63a8c77: user_path() now drops empty entries, so neither a leading ; nor a ;; inside a PATH can resolve against the current folder.

- macOS asks for Apple's Command Line Tools and goes on without waiting, so a
  declined prompt no longer holds an install for an hour.
- An install turn guards each install and GitHub setup, so two cannot share the
  cancel slot; ending a turn leaves the slot idle before the next can start.
- GitHub sign-in treats Git as best-effort, as harness installs do; Windows also
  finds Git in its usual folder when Lite's PATH predates it.
- Only a first install sets up Git, so updates never ask for a password.
- A cancelled root installer is reaped off the main thread, apt refreshes its
  lists first, and the gh download hides PowerShell's slow progress bar.
…l turn idle

- Windows reads its PATH again instead of checking Git's usual folder, so a Git
  installed while Lite runs is both found and runnable by Lite's own Git calls.
- A failed apt-get update no longer stops the Git install.
- A turn resets the cancel slot when it starts, so a late Cancel from the last
  turn cannot stop the next one.
@glenn-jocher
glenn-jocher merged commit a54f258 into main Nov 10, 2026
9 checks passed
@glenn-jocher
glenn-jocher deleted the fresh-computer-git branch November 10, 2026 16:27
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 Huge thanks to @glenn-jocher for the merged PR!

“Alone we can do so little; together we can do so much.” — Helen Keller

This brings Git and GitHub CLI setup together with agent installation and GitHub sign-in, helping Lite handle computers where those tools are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants