nikivdev/code · error
Could not determine GitHub owner. Configure it via: [git]
Error message
Could not determine GitHub owner. Configure it via: [git] fork-push-owner in flow.toml, or f env set FLOW_PUSH_OWNER=<owner> --personal, or gh auth login, or git config --global github.user <owner>
What it means
resolve_fork_owner resolves the GitHub account that owns the fork-push target by trying, in order: explicit config ([git] fork-push-owner in flow.toml), FLOW_PUSH_OWNER env var (plain and personal-scoped), `gh api user`, and `git config github.user`. When all sources are absent or empty it bails with this multi-line message enumerating every remedy. It guards against pushing a fork to an unknown destination.
Source
Thrown at src/push.rs:140
}
}
// Try `git config github.user`
if let Ok(output) = Command::new("git")
.args(["config", "github.user"])
.stdin(Stdio::null())
.stderr(Stdio::null())
.output()
{
if output.status.success() {
let user = String::from_utf8_lossy(&output.stdout).trim().to_string();
if !user.is_empty() {
return Ok(user);
}
}
}
bail!(
"Could not determine GitHub owner. Configure it via:\n \
[git] fork-push-owner in flow.toml, or\n \
f env set FLOW_PUSH_OWNER=<owner> --personal, or\n \
gh auth login, or\n \
git config --global github.user <owner>"
);
}
pub(crate) fn derive_repo_name(
repo_root: &Path,
upstream_url: Option<&str>,
origin_url: Option<&str>,
) -> Result<String> {
if let Some(url) = upstream_url {
if let Some((_owner, repo)) = parse_github_owner_repo(url) {
return Ok(repo);
}
}View on GitHub (pinned to a747e741ae)
Solutions
- Run `gh auth login` so `gh api user` can resolve your login automatically
- Set the env var: `f env set FLOW_PUSH_OWNER=<owner> --personal` (or export FLOW_PUSH_OWNER)
- Add to flow.toml: [git] fork-push-owner = "<owner>"
- Set git's fallback: `git config --global github.user <owner>`
Example fix
// before: none of the four sources configured $ f push Error: Could not determine GitHub owner... // after (any one of these) $ git config --global github.user myuser # or in flow.toml [git] fork-push-owner = "myuser"
Defensive patterns
Strategy: validation
Validate before calling
let ok = !std::process::Command::new("gh")
.args(["api","user","-q",".login"]).output()
.map(|o| o.status.success()).unwrap_or(false)
&& std::env::var("FLOW_PUSH_OWNER").is_err();
if ok {
eprintln!("no GitHub owner resolvable: run `gh auth login` or set FLOW_PUSH_OWNER");
} Try / catch
match run_push(cmd) {
Err(e) if e.to_string().contains("Could not determine GitHub owner") => {
eprintln!("run `gh auth login` or `f env set FLOW_PUSH_OWNER=<owner> --personal`");
}
other => other?,
} Prevention
- Run `gh auth login` on new machines before pushing
- Persist the owner with `f env set FLOW_PUSH_OWNER=<owner> --personal` or [git] fork-push-owner in flow.toml
- Set `git config --global github.user` as a last-resort fallback
When it happens
Trigger: No owner via CLI/config; FLOW_PUSH_OWNER unset (and no personal env entry); `gh` not authenticated or fails so `gh api user` yields no login; `git config github.user` unset globally and locally.
Common situations: Fresh machine before `gh auth login`; CI without any GitHub credentials or env vars; flow.toml missing the [git] fork-push-owner key; gh authenticated to a different host so `gh api user` fails for github.com.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- unable to determine GitHub repo (origin URL not GitHub, and
- Could not determine GitHub username
- gitedit owner not set (use --owner or GITEDIT_OWNER)
- could not determine repo name (use --repo)
- gh api user failed
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/f7d3f1a401f85ec3.
Report an issue: GitHub.