Zee
Zee

Reputation: 1420

Changing the location of git installation on linux

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?

Upvotes: 3

Views: 3742

Answers (1)

Sven Marnach
Sven Marnach

Reputation: 602485

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.

Upvotes: 5

Related Questions