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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s