{"record":{"id":"6a6cf6339992b6d4","repo":"nikivdev/code","slug":"global-core-hookspath-already-points-to-re-run","errorCode":null,"errorMessage":"Global core.hooksPath already points to {}.\nRe-run with `f push hooks install --force` to overwrite it.","messagePattern":"Global core\\.hooksPath already points to (.+?)\\.\nRe-run with `f push hooks install --force` to overwrite it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/push_hook.rs","lineNumber":78,"sourceCode":"            cmd.remote_name.as_deref(),\n            cmd.remote_url.as_deref(),\n            current_branch.as_deref(),\n            decision.policy.home_branch.as_deref(),\n        )?;\n    }\n\n    Ok(())\n}\n\npub fn install_hooks(force: bool) -> Result<()> {\n    let hooks_path = push_policy::effective_global_hooks_path()?;\n    let current_hooks_path = current_global_hooks_path()?;\n\n    if let Some(current) = current_hooks_path.as_ref()\n        && normalize_path(current) != normalize_path(&hooks_path)\n        && !force\n    {\n        bail!(\n            \"Global core.hooksPath already points to {}.\\nRe-run with `f push hooks install --force` to overwrite it.\",\n            current.display()\n        );\n    }\n\n    fs::create_dir_all(&hooks_path)\n        .with_context(|| format!(\"failed to create {}\", hooks_path.display()))?;\n    let hook_path = hooks_path.join(\"pre-push\");\n    if hook_path.exists() && !is_flow_managed_hook(&hook_path)? && !force {\n        bail!(\n            \"Refusing to overwrite non-Flow hook at {}.\\nRe-run with `f push hooks install --force` to replace it.\",\n            hook_path.display()\n        );\n    }\n\n    fs::write(&hook_path, render_pre_push_hook_script())\n        .with_context(|| format!(\"failed to write {}\", hook_path.display()))?;\n    #[cfg(unix)]","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/push_hook.rs#L60-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$ f push hooks install\nGlobal core.hooksPath already points to /home/u/.husky.\n// after\n$ f push hooks install --force","handlingStrategy":"validation","validationCode":"let current = std::process::Command::new(\"git\")\n    .args([\"config\", \"--global\", \"--get\", \"core.hooksPath\"])\n    .output()?;\nif current.status.success() {\n    let p = String::from_utf8_lossy(&current.stdout).trim();\n    eprintln!(\"existing global core.hooksPath = {p}; pass --force to replace\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"core.hooksPath already points to\") => {\n        eprintln!(\"decide: keep existing hooks or re-run install with --force\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["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"],"tags":["git-hooks","hooks-path","config-conflict"],"backgroundTag":"hooks-path-conflict","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}