msysgit在Windows上 - 我应该知道什么,如果有的话? [英] msysgit on windows -- what should I be aware of, if any?

查看:165
本文介绍了msysgit在Windows上 - 我应该知道什么,如果有的话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这最近与另一个问题有关。



安装msysgit时,安装程​​序会提供3个与系统路径相关的选项:
$ b


  1. 切勿更改窗口环境。使用此选项,您必须使用bashshell来使用git。

  2. 将git \ bin目录添加到PATH环境变量中,但而不会覆盖一些内置的窗口工具。研究员stackoverflow-ian Gabe Moothart 在评论中告诉我,这个选项会使一些git操作失败!这些操作是什么?我应该担心它们吗? 这些工具是什么?窗户的哪些部分依赖于它们?并会在实践中伤害吗?

另一个问题出现在我的脑海里,与系统PATH无关。 p>

如果我的项目目录中有符号链接和硬链接,该怎么办? git知道如何处理这些?或者,它会遭受无限递归,如果说,目录结构是这样的,一些文件夹实际上是它的父母之一的符号链接?

解决方案

无论您选择哪个选项,您都得到 bash ,后面的选项只是添加了在其外部使用Git的方法。



对于后面的选项, msysgit 将常见Linux实用程序的Windows版本添加到 PATH 。这包括 find kill sort 以及 cp ls rm 以及其他约20-30个。



前3个(以及类似的)的问题在于它们存在于两个操作系统中,并且在每个操作系统中的功能都不相同。



如果你知道你将会使用哪一个,那么你需要考虑一下,但是任何开发期望的应用程序和获得其他应用程序肯定会适合。




为了避免冲突,虽然Git仍能按预期工作,但您可以创建一个简单的批处理脚本,仅针对会话调整 PATH 。 (例如, readygit.bat

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

相应地调整 C:\Git\bin 。但是,只需在 cmd 中运行这个并使用Gi​​t即可。使用此功能,您可以使用安装选项3和从系统的 PATH 中安全地移除 C:\Git\bin ,消除Windows应用程序的混淆,同时不会混淆Git 。



我目前使用的脚本类似 GnuWin 应用程序,包括 查找

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 git\bin 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?

解决方案

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.

这篇关于msysgit在Windows上 - 我应该知道什么,如果有的话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆