使用 MinGW 的 msysGit,反之亦然
我使用 git 作为我的版本控制系统。为此,我安装了 msysGit 来检查 MSW 上的存储库。现在我想用 MinGW 编译我的程序并为我发现了这个“问题”: 当我通过 mingw-get 安装 MinGW 和 MSYS 时,我可以编译我的程序,没有问题。但我无法访问 git。当我使用Git Bash时,我可以使用git,但无法编译。
是否有可能:
- 将 MinGW 安装到“Git Bash”中(因为它已经包含 msys,不是吗?)或者
- 在两个安装之间设置“链接”以使其工作。
我更喜欢能够更轻松地使两个软件包保持最新的方式。
提前致谢 :)
I am using git as my revision control system. To do so, I installed msysGit to checkout my repositories on MSW. Now I want to compile my programs with MinGW and found this "problem" for me:
When I install MinGW and MSYS via mingw-get I can compile my program, no problem. But I can not access git. When I use the Git Bash, I can work with git, but can not compile.
Is there any possibility to:
- install MinGW "into" Git Bash (because it already contains msys, didn't it?) OR
- to set "links" between both installations to make it work.
I would prefere the way I can keep both packages up to date more easily.
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您选择第二个选项,您可以在 MinGW 中添加指向 git 的符号链接。
因此,如果您的 msysgit 安装在 C:\Program Files (x86)\Git 中
打开 MinGW shell 并输入:
这将在 MinGW 的 /usr/bin 中创建一个名为 git 的符号链接,指向 msysgit 安装。
然后您可以在 MinGW shell 的任何位置使用 git 命令。
You can add a symbolic link to git in MinGW, if you chose the second option.
So if your msysgit installation is in C:\Program Files (x86)\Git
Open the MinGW shell and type:
This will create a symbolic link called git in MinGW's /usr/bin pointing to the msysgit installation.
Then you can use the git command anywhere from the MinGW shell.
你是如何安装Msysgit的?您是否在要求设置 PATH 的屏幕中选择了第三个选项?
(以上屏幕截图来自:http://ekkescorner.files.wordpress.com/2010/02/git-windows-msysgit-install-3.png< /a>.)
您必须选择第三个选项,甚至第二个选项就足够了。
下面是我的 MingW 的屏幕截图
无论如何,这都是关于在 msysgit 中设置 git.exe 的正确路径,或者我错过了什么?
How did you install Msysgit? Did you choose the third option in the screen where it asks for PATH setup?
(above screenshot from: http://ekkescorner.files.wordpress.com/2010/02/git-windows-msysgit-install-3.png.)
You have to choose the third option or even second might suffice.
Below is screenshot from my MingW
Anyway, it's all about setting proper path to the git.exe in msysgit, or am I missing something?
您需要修复 PATH,以便运行与 msys 或 msysgit 环境匹配的外部命令。根据您安装这两个 shell 环境的方式,其中一个将位于 PATH 中的第一个,因此无论您运行哪个 bash,您都将从位于 PATH 中的第一个目录的 bin 目录运行外部命令。
您可以通过从不同的 bash shell 运行 ls.exe 来测试这一点,我发现一个有效,一个无效,但是当我修复 PATH 时,它们都有效。
我试图制定一个对两者都适用的巧妙脚本,但这很困难,因为它们都将自己的 bin 目录映射到 /bin。当我厌倦了尝试解决这个问题时,我分别使用以下行创建了 msys.sh 和 msysgit.sh :
或
。这些文件需要来源于您正在运行的环境。例如:
实际上你只需要一个脚本,因为一个环境就可以工作,但我还安装了 RubyDevKit,它也有同样的问题,因此为每个环境创建一个脚本似乎更简单。
You need to fix up the PATH so that you are running the external commands that match the msys or msysgit environment. Depending on how you installed these two shell environments one of them will be first in the PATH so regardless of which bash you are running you will be running external commands from the bin directory which is first in the PATH.
You can test this by running ls.exe from the different bash shells, I found one worked and one didn't but when I fixed up the PATH they both worked.
I tried to work out a clever script that would work for both but it is difficult as they both map their own bin directory to /bin. When I got sick of trying to work this out I created msys.sh and msysgit.sh with the line:
or
respectively. These files need to be sourced into the environment you are running. For example:
You actually only need one script as one environment will work, but I also installed RubyDevKit which had the same problem so it seemed simpler to create a script for each environment.
如果您希望每次在 Windows 上启动 git bash 时更改路径。
您需要执行以下步骤:
If you want the path change every time you start your git bash on windows.
You need do the following steps: