hashicorp/vagrant · error · VagrantPlugins::HerokuPush::Errors::GitNotFound
The Git binary '%{bin}' could not be found. Please ensure yo
Error message
The Git binary '%{bin}' could not be found. Please ensure you
have downloaded and installed the latest version of Git:
https://git-scm.com/downloads What it means
The Heroku push shells out to git for every operation (branch detection, remote management, push). Before anything it calls verify_git_bin!, which runs Vagrant::Util::Which on the configured git path (config.git_bin, default 'git') and raises Errors::GitNotFound when the binary cannot be located. %{bin} is the exact path that failed to resolve.
Source
Thrown at plugins/pushes/heroku/push.rb:41
branch = git_branch(dir)
# Get the name of the app
app = config.app || interpret_app(dir)
# Check if we need to add the git remote
if !has_git_remote?(config.remote, dir)
add_heroku_git_remote(config.remote, app, dir)
end
# Push to Heroku
git_push_heroku(config.remote, branch, dir)
end
# Verify that git is installed.
# @raise [Errors::GitNotFound]
def verify_git_bin!(path)
if Vagrant::Util::Which.which(path).nil?
raise Errors::GitNotFound, bin: path
end
end
# Verify that the given path is a git directory.
# @raise [Errors::NotAGitRepo]
# @param [String]
def verify_git_repo!(path)
if !File.directory?(git_dir(path))
raise Errors::NotAGitRepo, path: path
end
end
# Interpret the name of the Heroku application from the given path.
# @param [String] path
# @return [String]
def interpret_app(path)
File.basename(path)
endView on GitHub (pinned to 35f3160f4a)
Solutions
- Install Git from https://git-scm.com/downloads and confirm `git --version` works in the same shell that runs vagrant
- Set an absolute path in the push block: cfg.git_bin = "C:\\Program Files\\Git\\bin\\git.exe"
- Restart the terminal/CI agent after PATH changes so Vagrant sees the updated environment
Example fix
# before config.push.define "heroku" do |p| p.git_bin = "git2" # typo, not on PATH end # after config.push.define "heroku" do |p| p.git_bin = "C:\\Program Files\\Git\\bin\\git.exe" end
Defensive patterns
Strategy: validation
Validate before calling
abort "git not found - install from https://git-scm.com/downloads" if Vagrant::Util::Which.which("git").nil? Type guard
def git_available?(bin = "git") !Vagrant::Util::Which.which(bin).nil? end
Try / catch
begin
env.cli(%w(push heroku))
rescue VagrantPlugins::HerokuPush::Errors::GitNotFound => e
abort "Missing git at '#{e.extra_data[:bin]}' - fix PATH or git_bin"
end Prevention
- Install git in CI images before any vagrant push step
- Set git_bin to an absolute path when the host PATH is unreliable
- Restart terminals/agents after PATH edits
When it happens
Trigger: vagrant push heroku on a host without git installed, git not on the PATH Vagrant inherits, or config.git_bin set to a wrong or non-executable path.
Common situations: Minimal CI containers without git; Windows hosts where git is installed but not on PATH for the shell running Vagrant; typos in the push block's git_bin option.
Related errors
- The following path is not a valid Git repository: %{pat
- The following command exited with a non-zero exit status:
- Vagrant was unable to find the Atlas uploader CLI. If your V
- The push strategy '%{name}' is not defined in the Vagrantfil
- There are no push strategies named '%{name}'. Please make su
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/06d0641ff074a15a.
Report an issue: GitHub.