Skip to content

bootstrap-repo.sh: gh detected but not authenticated causes silent failure instead of falling back to git clone #59

@Svtter

Description

@Svtter

Problem

bootstrap-repo.sh line 25 checks command -v gh to decide whether to use gh repo clone or git clone. If gh is installed but not authenticated, it enters the gh repo clone branch and fails with an auth error — instead of falling back to git clone.

This is a common scenario: gh may be installed via package manager but never logged in, or the login session may have expired.

Reproduction

  1. Install gh but do NOT run gh auth login
  2. Run bash scripts/send-file.sh some-file.html
  3. Expected: falls back to git clone (which may succeed if git credentials are configured)
  4. Actual: fails with `To get started with GitHub CLI, please run: gh auth login`

Suggested Fix

Check not just command -v gh but also whether gh is actually authenticated:

if command -v gh >/dev/null 2>&1 && gh auth status &>/dev/null; then
    gh repo clone sun-praise/static-html "$repo_dir" -- --branch "$repo_ref"
else
    git clone --branch "$repo_ref" "$repo_https_url" "$repo_dir"
fi

This way, if gh exists but is not logged in, it gracefully falls back to git clone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions