nikivdev/code · error

git pull failed

Error message

git pull failed

What it means

update_flow_repo shells out to `git pull` in the flow repo with inherited stdio. If the child git process exits with a non-zero status, the wrapper bails with this generic error. The detailed reason is only visible on stderr, not in the error message itself.

Solutions

  1. Read the git stderr printed above the error to see the actual cause, then fix git state (e.g. git -C ~/code/flow status)
  2. Resolve conflicts or stash/discard local changes, then pull manually: git -C ~/code/flow pull
  3. Set upstream/auth: git -C ~/code/flow branch --set-upstream-to=origin/<branch> and refresh credentials; check network/VPN

Example fix

// before
if !status.success() {
    bail!("git pull failed");
}
// after
if !status.success() {
    bail!("git pull failed in {} (exit code {:?})", root.display(), status.code());
}
Defensive patterns

Strategy: try-catch

Validate before calling

let status = std::process::Command::new("git")
    .args(["-C", "~/code/flow", "status", "--porcelain"])
    .status()
    .expect("git not available");
if !status.success() {
    eprintln!("flow repo git state is broken; fix before updating");
}

Try / catch

if let Err(e) = update_flow_repo(&root) {
    if e.to_string().contains("git pull failed") {
        eprintln!("See git stderr above; try: git -C ~/code/flow pull manually");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Running run (which calls update_flow_repo) when `git pull` fails: no remote configured, no upstream branch, merge conflicts with local changes, network/auth failure to the remote, or detached HEAD state.

Common situations: Local commits/diverged branch in ~/code/flow; VPN off or credentials expired so the remote is unreachable; repo cloned without pushing an upstream branch; rebase conflicts with dirty working tree.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/9b379443ff0bfa34. Report an issue: GitHub.

Appendix: source

Thrown at src/latest.rs:43

}

fn update_flow_repo(root: &PathBuf) -> Result<()> {
    println!("Updating {}", root.display());
    let status = Command::new("git")
        .args([
            "-C",
            root.to_str().unwrap_or(""),
            "pull",
            "--rebase",
            "--autostash",
        ])
        .stdin(Stdio::inherit())
        .stdout(Stdio::inherit())
        .stderr(Stdio::inherit())
        .status()
        .context("failed to run git pull")?;
    if !status.success() {
        bail!("git pull failed");
    }
    Ok(())
}

fn rebuild_flow(root: &PathBuf) -> Result<()> {
    let prev = std::env::current_dir().context("failed to read current directory")?;
    std::env::set_current_dir(root)
        .with_context(|| format!("failed to switch to {}", root.display()))?;
    let result = deploy::run(DeployCommand { action: None });
    std::env::set_current_dir(prev).context("failed to restore previous directory")?;
    result
}

fn reload_fish_shell() -> Result<()> {
    if std::env::var("FISH_VERSION").is_err() {
        return Ok(());
    }
    if !atty::is(atty::Stream::Stdout) {

View on GitHub (pinned to a747e741ae)