{"record":{"id":"c0b2225df46fbb38","repo":"hashicorp/vagrant","slug":"the-following-path-is-not-a-valid-git-repository","errorCode":null,"errorMessage":"The following path is not a valid Git repository:\n\n    %{path}\n\nPlease ensure you are working in the correct directory. In order to use\nthe Vagrant Heroku Push plugin, you must have a git repository.","messagePattern":"The following path is not a valid Git repository:\n\n    %(.+?)\n\nPlease ensure you are working in the correct directory\\. In order to use\nthe Vagrant Heroku Push plugin, you must have a git repository\\.","errorType":"exception","errorClass":"VagrantPlugins::HerokuPush::Errors::NotAGitRepo","httpStatus":null,"severity":"error","filePath":"plugins/pushes/heroku/push.rb","lineNumber":50,"sourceCode":"\n        # Push to Heroku\n        git_push_heroku(config.remote, branch, dir)\n      end\n\n      # Verify that git is installed.\n      # @raise [Errors::GitNotFound]\n      def verify_git_bin!(path)\n        if Vagrant::Util::Which.which(path).nil?\n          raise Errors::GitNotFound, bin: path\n        end\n      end\n\n      # Verify that the given path is a git directory.\n      # @raise [Errors::NotAGitRepo]\n      # @param [String]\n      def verify_git_repo!(path)\n        if !File.directory?(git_dir(path))\n          raise Errors::NotAGitRepo, path: path\n        end\n      end\n\n      # Interpret the name of the Heroku application from the given path.\n      # @param [String] path\n      # @return [String]\n      def interpret_app(path)\n        File.basename(path)\n      end\n\n      # The git directory for the given path.\n      # @param [String] path\n      # @return [String]\n      def git_dir(path)\n        \"#{path}/.git\"\n      end\n\n      # The name of the current git branch.","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/pushes/heroku/push.rb#L32-L68","documentation":"The Heroku push builds everything from a git repository at config.dir (default '.'). verify_git_repo! checks File.directory?(\"#{path}/.git\") and raises Errors::NotAGitRepo with %{path} when that directory does not exist. Because it tests for a .git directory, git worktrees/submodules (where .git is a file) also trip it.","triggerScenarios":"Running vagrant push heroku from a directory without a .git directory: fresh template, extracted archive, or a linked worktree/submodule where .git is a file; or setting config.dir in the push block to a non-repo path.","commonSituations":"Deploying from an exported/zip'd source tree that was never git-cloned; worktrees; pointing dir at a build-output folder.","solutions":["Run vagrant push from a real git clone (git init + commit if starting fresh)","Check the push block's dir option points at the repo root containing .git","If using a git worktree or submodule, push from the main checkout instead — the .git file layout fails File.directory?","For non-git workflows, use the ftp/local push strategy instead of heroku"],"exampleFix":"# before\nconfig.push.define \"heroku\" do |p|\n  p.dir = \"./dist\"   # no dist/.git -> NotAGitRepo\nend\n\n# after\ngit init && git add . && git commit -m \"deploy\"\nconfig.push.define \"heroku\" do |p|\n  p.dir = \".\"        # repo root with .git directory\nend","handlingStrategy":"validation","validationCode":"dir = \".\"   # or your push config.dir\nabort \"#{dir} is not a git repo\" unless File.directory?(File.join(dir, \".git\"))","typeGuard":"def git_repo_dir?(path)\n  File.directory?(File.join(path.to_s, \".git\"))\nend","tryCatchPattern":"begin\n  env.cli(%w(push heroku))\nrescue VagrantPlugins::HerokuPush::Errors::NotAGitRepo => e\n  abort \"Push from a real git clone: #{e.extra_data[:path]}\"\nend","preventionTips":["Push only from a cloned repo, never from exported archives","Note the .git-file (worktree/submodule) layout fails this check - use the main checkout","Verify config.dir points at the repo root"],"tags":["heroku","push","git","repository","deploy"],"backgroundTag":"not-a-git-repository","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}