nikivdev/code · error
Global core.hooksPath already points to {}. Re-run with `f p
Error message
Global core.hooksPath already points to {}.
Re-run with `f push hooks install --force` to overwrite it. What it means
Raised by install_hooks in src/push_hook.rs when the global git config already defines core.hooksPath pointing to a directory different from the Flow hooks directory, and --force was not passed. Installing would hijack the existing global hooks location, so the tool refuses unless explicitly forced.
Source
Thrown at src/push_hook.rs:78
cmd.remote_name.as_deref(),
cmd.remote_url.as_deref(),
current_branch.as_deref(),
decision.policy.home_branch.as_deref(),
)?;
}
Ok(())
}
pub fn install_hooks(force: bool) -> Result<()> {
let hooks_path = push_policy::effective_global_hooks_path()?;
let current_hooks_path = current_global_hooks_path()?;
if let Some(current) = current_hooks_path.as_ref()
&& normalize_path(current) != normalize_path(&hooks_path)
&& !force
{
bail!(
"Global core.hooksPath already points to {}.\nRe-run with `f push hooks install --force` to overwrite it.",
current.display()
);
}
fs::create_dir_all(&hooks_path)
.with_context(|| format!("failed to create {}", hooks_path.display()))?;
let hook_path = hooks_path.join("pre-push");
if hook_path.exists() && !is_flow_managed_hook(&hook_path)? && !force {
bail!(
"Refusing to overwrite non-Flow hook at {}.\nRe-run with `f push hooks install --force` to replace it.",
hook_path.display()
);
}
fs::write(&hook_path, render_pre_push_hook_script())
.with_context(|| format!("failed to write {}", hook_path.display()))?;
#[cfg(unix)]View on GitHub (pinned to a747e741ae)
Solutions
- If you accept replacing it, re-run with `f push hooks install --force`
- Inspect the existing setting with `git config --global core.hooksPath` and decide whether to keep it (skip installing Flow hooks)
- Uninstall the other hook manager's global hooksPath first (`git config --global --unset core.hooksPath`), then install Flow hooks without force
Example fix
// before $ f push hooks install Global core.hooksPath already points to /home/u/.husky. // after $ f push hooks install --force
Defensive patterns
Strategy: validation
Validate before calling
let current = std::process::Command::new("git")
.args(["config", "--global", "--get", "core.hooksPath"])
.output()?;
if current.status.success() {
let p = String::from_utf8_lossy(¤t.stdout).trim();
eprintln!("existing global core.hooksPath = {p}; pass --force to replace");
} Try / catch
match result {
Err(e) if e.to_string().contains("core.hooksPath already points to") => {
eprintln!("decide: keep existing hooks or re-run install with --force");
}
Err(e) => return Err(e),
Ok(v) => Ok(v),
} Prevention
- Check `git config --global core.hooksPath` before installing
- Uninstall other global hook managers (husky/pre-commit) first
- Use --force only when you intentionally replace the hooks location
When it happens
Trigger: Running `f push hooks install` when `git config --global core.hooksPath` returns a path that normalizes to something other than Flow's effective global hooks path, without --force.
Common situations: Another tool (Husky, pre-commit, lefthook) previously installed global hooks; user moved or renamed Flow's hooks directory; switching between Flow and another hook manager on the same machine.
Related errors
- remote '{}' already points to {} refusing to overwrite witho
- Refusing to overwrite non-Flow hook at {}. Re-run with `f pu
- prek pre-push validation failed
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/6a6cf6339992b6d4.
Report an issue: GitHub.