gastownhall/beads · error
git ls-remote %s failed: %s: %w
Error message
git ls-remote %s failed: %s: %w
What it means
lsRemoteDoltDataRefs runs 'git ls-remote <url> <dolt-data-ref> <dolt-info-ref>' with a 60-second timeout to discover Dolt data refs on a git-backed remote, and wraps any non-zero exit (including timeout) into this error with the combined stdout/stderr from git. The wrapped output usually contains git's real diagnosis (auth failure, unknown host, no repository).
Source
Thrown at cmd/bd/dolt_remote_reset_data.go:126
func resetDataGitURL(url string) string {
if trimmed := strings.TrimPrefix(url, "git+"); trimmed != url {
return trimmed
}
if path, isFile := resetDataFilePath(url); isFile && !strings.HasPrefix(url, "file://") {
return "file://" + path
}
return url
}
// lsRemoteDoltDataRefs returns which of the Dolt data-plane refs currently
// exist on the git remote at gitURL.
func lsRemoteDoltDataRefs(ctx context.Context, gitURL string) ([]string, error) {
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, "git", "ls-remote", gitURL, gitDoltDataRef, gitDoltInfoRef) // #nosec G204 -- URL from configured remote
out, err := cmd.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("git ls-remote %s failed: %s: %w", gitURL, strings.TrimSpace(string(out)), err)
}
var refs []string
for _, line := range strings.Split(strings.TrimSpace(string(out)), "\n") {
fields := strings.Fields(line)
if len(fields) == 2 {
refs = append(refs, fields[1])
}
}
return refs, nil
}
// deleteGitDoltDataRefs deletes refs on the git remote at gitURL. Git
// client-side hooks are disabled for the push, same as bd's other internal
// git invocations (GH#3724 class: a user's templated pre-push hook must not
// break — or observe — bd's data-plane plumbing).
func deleteGitDoltDataRefs(ctx context.Context, gitURL string, refs []string) error {
args := []string{"push", gitURL}
for _, ref := range refs {View on GitHub (pinned to 71377f2769)
Solutions
- Run 'git ls-remote <url>' manually to see the raw git error and fix that (credentials, URL, network)
- Ensure credentials are available: configure SSH keys (ssh-add) or a credential helper/token for HTTPS
- Confirm the remote URL is correct with git remote -v / bd dolt remote -v
- Check network/VPN connectivity; if operations are slow, note the 60-second timeout may need the underlying network fixed rather than retried blindly
Example fix
// before remote = git@host:org/repo.git # SSH key not loaded -> permission denied // after ssh-add ~/.ssh/id_ed25519 && bd dolt remote reset-data origin
Defensive patterns
Strategy: retry
Validate before calling
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
out, err := exec.CommandContext(ctx, "git", "ls-remote", url).CombinedOutput()
if err != nil { return fmt.Errorf("pre-flight ls-remote failed: %s", out) } Try / catch
refs, err := lsRemoteDoltDataRefs(ctx, gitURL)
if err != nil {
var netErr error
if errors.As(err, &netErr) && ctx.Err() == context.DeadlineExceeded {
// retry once after checking connectivity
}
} Prevention
- Verify 'git ls-remote <url>' works interactively before scripting reset-data
- Load SSH keys (ssh-add) or configure credential helpers in CI
- Remember the built-in 60s timeout; fix network latency rather than looping retries
When it happens
Trigger: bd dolt remote reset-data against a git-backed remote where git ls-remote fails: bad URL, missing/invalid credentials, SSH key not loaded, network outage, or the 60s context timeout elapsing on a hung connection.
Common situations: CI lacking deploy-key access to the remote; HTTPS remote requiring a token that isn't configured; private remote behind VPN that's down; typo'd remote URL; very slow network exceeding the 60s timeout.
Related errors
- git push (delete %s) failed: %s: %w
- fetch from %s/%s: %w
- server not reachable: %w
- failed to install hooks: %w
- git config --unset core.hooksPath failed: %w (output: %s)
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/49503c6e3af0306e.
Report an issue: GitHub.