Is the option “Use Git and optional Unix tools from the Windows Command Prompt” dangerous

cygwin;gitmsysmsysgit

When installing Git, it offers the option to add all of its msys *nix tools into your PATH, however it warns:

Warning: This will override Windows tools like "find" and "sort". Only use this option if you understand the implications.

My questions are:

  • Which tools exactly will it conflict with?
  • Does it matter? Are they commonly used by the system? (I've never used them personally.)
  • Can I just change the order of the directories in the PATH to prevent conflicts?
  • Is this what the 2nd option does? ("Use Git from the Windows Command Prompt — This option is considered safe as it only adds some minimal Git wrappers")

Best Answer

I agree with the other answers' general analysis and am also unable to predict exactly what kind of conflicts you could run into. I know I haven't noticed anything awry myself taking the third option. But I can add a little to what the options actually do as of 2018.

I experimented with a variety of installation configurations while deciding how to suggest my team transition to git, including these options. This is what I actually observed the installation doing to my path, as of git for Windows v2.19.1.

screenshot of Git For Windows installation options for setting the PATH

Use Git from Git Bash only

As it states, no modifications are made to your system's path. Entering a simple git status on the Windows command prompt, cmd.exe, will fail with 'git' is not recognized as an internal or external command, operable program or batch file.

Use Git from the Windows Command Prompt

Can I just change the order of the directories in the PATH to prevent conflicts?

Is this what the 2nd option does? ("Use Git from the Windows Command Prompt -- This option is considered safe as it only adds some minimal Git wrappers")

Changing the order is always an option for you, but no, the second choice appears to have nothing to do with ordering. (Path additions seem to go to the end of the path regardless. I'm a little suspicious this changed at some point.) It's a question of which directories are added to the path, and is different between the second and third options.

When it says it will add "minimal" Git wrappers to your PATH, what it appears to actually do is add the cmd folder of the (coming) installation to the path. This is the option I eventually suggested to my team. We now have C:\Program Files\Git\cmd on our paths.

What's in the cmd directory? For me, only six files:

  • git.exe
  • git-gui.exe
  • gitk.exe
  • git-lfs.exe
  • start-ssh-agent.cmd
  • start-ssh-pageant.cmd

As with Anaksunaman's answer, I'm not sure when this would not be enough. Any of the normal commands starting with git <some command> would work from the inclusion of git.exe.

Use Git and optional Unix tools from the Windows Command Prompt

This includes the second option's adding <Install dir>\Git\cmd to the path, and also adds <Install dir>\Git\mingw64\bin and <Install dir>\Git\usr\bin to the path. Both directories have a significant number of executables, including find, sort, and kill as mentioned in other answers.

Rather than listing what's probably a couple hundred items, I'd encourage the concerned user to take option two, complete the installation, and go take a look at those directories. If you're satisfied with the risk, adding <Install dir>\Git\mingw64\bin and <Install dir>\Git\usr\bin to your path yourself would be equivalent to taking a time machine back and selecting the third option.

Related Question