I've just set up a new computer. When I installed Visual Studio I didn't install Git because I don't want to use it from within VS. Instead I installed Git for Windows. However, a script we use to build the project uses git, and it runs the MSVC command line, so as it turns out, I need the VS command line's PATH variable to contain the folder where git.exe is located.

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

I've tried uninstalling Git for Windows and starting the VS installer again, hitting Modify and then adding Git and Github, but that didn't help.

Here's a similar question but the answer is to set the path from the command line, something I don't want to do. Adding an environment path to the Visual studio command prompt

Update Hmm, actually I'm not sure if it's the VC command line. Is there a way to find out? Because %PATH% contains the git folder on BOTH the "normal" Windows command line AND with the one in MSVC tools (though there are more than one). But not when I'm running our build tool, for some reason. It's more like VS cmd's path than Windows's but it lacks the git path.

  • Sounds like you need to add git to the PATH in the build tool script file. – DavidPostill Apr 8 '16 at 10:23
  • Mmm, but since git can be installed anywhere I'd rather not add a hardcoded path to the build config. – Srekel Apr 8 '16 at 14:16
  • So use an envrionment variable GIT_INSTALL=c:\pathtogit\ and add %GIT_INSTALL% to the PATH in the script file ... – DavidPostill Apr 8 '16 at 14:19
  • Yeah I mean I could do that but it really shouldn't be necessary as I've not had to do it on the other two computers I've set this up on. And environment variables are such a hassle I'd rather not if it can be avoided. Thanks for the suggestion though. :) – Srekel Apr 8 '16 at 14:30

It works now. I think the problem was Tundra, the build system. I removed the cached Tundra files for the project and I think it started working after that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.