Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using msysGit from MinGW and vice versa

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 :)

like image 445
tbolender Avatar asked May 04 '11 14:05

tbolender


3 Answers

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:

cd /usr/bin
ln -s /c/Program\ Files\ \(x86\)/Git/bin/git git

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.

like image 188
Guilherme Avatar answered Nov 14 '22 14:11

Guilherme


How did you install Msysgit? Did you choose the third option in the screen where it asks for PATH setup?

enter image description here

(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

enter image description here

Anyway, it's all about setting proper path to the git.exe in msysgit, or am I missing something?

like image 32
manojlds Avatar answered Nov 14 '22 14:11

manojlds


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:

export PATH=/c/MinGW/msys/1.0/bin:/c/MinGW/bin:${PATH}

or

export PATH="/c/Program Files (x86)/Git/bin:${PATH}"

respectively. These files need to be sourced into the environment you are running. For example:

source ./msys.sh

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.

like image 39
oenpelli Avatar answered Nov 14 '22 12:11

oenpelli