Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the location of git installation on linux

Tags:

git

linux

redhat

I apologize if this seems basic but I'm new to linux and not really sure how to proceed. My current git version is 1.7.1 and is located in /usr/bin/git but a newer version of git (1.8) is now available in /usr/src/git/bin/git. How do I make git use this version by default as opposed to the 1.7.1 version?

like image 615
Zee Avatar asked Nov 25 '25 17:11

Zee


1 Answers

You have to make sure to call the right executable. This can ben done by explicitly calling /usr/src/git/bin/git instead of git. Of course this would be annoying to type all the time, so you can either make git an alias for that path by adding the line

alias git=/usr/src/git/bin/git

to your .bashrc, or add the directory /usr/src/git/bin to your binary search path by adding the line

export PATH="/usr/src/git/bin:$PATH"

To test that the other git installation searches for the core binaries in the right place, you can check the output of git --exec-path.

like image 135
Sven Marnach Avatar answered Nov 28 '25 15:11

Sven Marnach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!