Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
481 views
in Technique[技术] by (71.8m points)

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

This is related to another question I asked recently.

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

  1. Never change windows environment. With this option, you have to use the "bash" shell to work with git.

  2. Add the gitin directory to the PATH environment variable, but without overriding some builtin windows tools. Fellow stackoverflow-ian Gabe Moothart told me in a comment that this option will make some git operations fail! What are these operations? Should I worry about them?

  3. Same as 2 but override some default system tools. What are these tools? What parts of windows depend on them? and will this hurt in practice?

Another issue has come to my mind, unrelated to the system PATH.

What if I have symbolic links and hard links inside my project directory? Does git know how to deal with these? or, will it suffer from infinite recursion, if say, the directory structure was such that some folder was actually a symbolic link to one of its parents?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:Gitin;%PATH%
cmd

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

With this, you can use install option 3 and safely remove C:Gitin 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...