Error: ‘git’ is not recognized as an internal or external command, operable program or batch file.

Today I wanted to add one of my Github repositories to a sbt project. I was working on my Windows laptop. I setup the following Build.scala file and placed it in the project directory under the root directory of my sbt project:

import sbt._

object Version {
  val scalaDownloader = "v0.5.1"
}

object Projects {
	lazy val scalaDownloader = RootProject(uri(s"https://github.com/nidkil/ScalaDownloader.git#${Version.scalaDownloader}"))
}

object MyBuild extends Build {
	lazy val root = Project("root", file(".")).dependsOn(Projects.scalaDownloader)
}

When I ran this in sbt I got the following error:

'git' is not recognized as an internal or external command,
operable program or batch file.

It turns out sbt calls Git and I had installed Git with option “Use Git from Git Bash only“. After reinstalling Git with the option “Use Git from Windows Command Prompt” it worked.

Hope this helps someone.

Leave a comment