{"record":{"id":"97695f8597ef665c","repo":"sds/overcommit","slug":"is-not-a-directory","errorCode":null,"errorMessage":"is not a directory","messagePattern":"is not a directory","errorType":"exception","errorClass":"Overcommit::Exceptions::InvalidGitRepo","httpStatus":null,"severity":"error","filePath":"lib/overcommit/installer.rb","lineNumber":89,"sourceCode":"    end\n\n    def old_hooks_path\n      File.join(hooks_path, 'old-hooks')\n    end\n\n    def master_hook_install_path\n      File.join(hooks_path, 'overcommit-hook')\n    end\n\n    def ensure_directory(path)\n      FileUtils.mkdir_p(path)\n    end\n\n    def validate_target\n      absolute_target = File.expand_path(@target)\n\n      unless File.directory?(absolute_target)\n        raise Overcommit::Exceptions::InvalidGitRepo, 'is not a directory'\n      end\n\n      git_dir_check = Dir.chdir(absolute_target) do\n        Overcommit::Utils.execute(%w[git rev-parse --git-dir])\n      end\n\n      unless git_dir_check.success?\n        raise Overcommit::Exceptions::InvalidGitRepo, 'does not appear to be a git repository'\n      end\n    end\n\n    def install_master_hook\n      FileUtils.mkdir_p(hooks_path)\n      FileUtils.cp(MASTER_HOOK, master_hook_install_path)\n    end\n\n    def uninstall_master_hook\n      FileUtils.rm_rf(master_hook_install_path, secure: true)","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/installer.rb#L71-L107","documentation":"The first check Installer#run performs on its target: File.expand_path(@target) must be an existing directory. If not, it raises InvalidGitRepo with the terse message 'is not a directory', which the CLI presents alongside the target path.","triggerScenarios":"'overcommit --install <path>' (or --uninstall/--update) where <path> does not exist, is a file rather than a directory, or is a relative path resolved from the wrong working directory.","commonSituations":"Typo in an install script; passing a repo URL or archive path instead of a local directory; relative path used from a different cwd in CI or bootstrap scripts.","solutions":["Re-run with the correct absolute path: 'overcommit --install /abs/path/to/repo'","If the directory should exist, create it first: 'mkdir -p <target>' and retry","Check scripts that build the target path for typos and unexpanded variables"],"exampleFix":"# before\n$ overcommit --install src/mrepo   # typo, does not exist\n\n# after\n$ overcommit --install \"$(pwd)/src/myrepo\"","handlingStrategy":"validation","validationCode":"target = File.expand_path(ARGV[0])\nabort \"#{target} is not a directory\" unless File.directory?(target)\nOvercommit::Installer.new(logger).run(target, action: :install)","typeGuard":"def installable_target?(path)\n  File.directory?(File.expand_path(path))\nend","tryCatchPattern":"begin\n  installer.run(target, action: :install)\nrescue Overcommit::Exceptions::InvalidGitRepo => e\n  abort \"#{target}: #{e.message}\"\nend","preventionTips":["Expand paths to absolute form before passing them to the installer in scripts","Validate user-supplied paths with File.directory? before invoking the CLI"],"tags":["cli","filesystem","path-validation","overcommit"],"backgroundTag":"directory-not-found","analyzedSha":"fee0cd74b26eb81f64b43b7fab17bbb541575cc4","analyzedAt":"2026-08-23T04:07:28.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}