msysgit on windows — what should I be aware of, if any?

前端 未结 5 806
你的背包
你的背包 2020-12-02 08:44

This is related to another question I asked recently.

When installing msysgit, the installer presents 3 options related to system path:

  1. Never change

5条回答
  •  不思量自难忘°
    2020-12-02 09:14

    You get bash regardless of which option you pick, the latter options just add methods for using Git outside it.

    For the latter options, msysgit adds Windows builds of common Linux utilities to PATH. This includes find, kill and sort, as well as cp, ls, rm, and about 20-30 others.

    The problem with the first 3 (and similar) is that they exist in both OSs and function differently in each.

    Not a huge ordeal if you know which one you'll be using, but any applications developed expecting one and getting the other will surely throw a fit.


    To prevent the conflict, while still having Git work as expected, you can create a simple batch script that adjusts PATH only for the session. (e.g., readygit.bat)

    @echo off
    setlocal
    set PATH=C:\Git\bin;%PATH%
    cmd
    

    Adjust C:\Git\bin accordingly. But, just run this and use Git within the cmd.

    With this, you can use install option 3 and safely remove C:\Git\bin from your system's PATH, removing any confusion for Windows apps without confusing Git.

    I currently use a similar script with GnuWin apps, including find.

提交回复
热议问题