Reputation: 3579
I have two git in my CentOS-7.2 now.
[root@www bin]# /usr/bin/git --version
git version 1.8.3.1
[root@www bin]# /usr/local/git/bin/git --version
git version 2.9.5
I use the git
it default is git 1.8.3.1
this one.
I want to use the git
default as the this one /usr/local/git/bin/git
.
How can I remove the /usr/bin/git
and use the new version one?
I tried use the:
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
But the git
default still is git 1.8.3.1
, how can I realize my requirement?
Should I delete the old version one?
Upvotes: 2
Views: 403
Reputation: 339
try running this command
update-alternatives --set git /usr/local/git/bin/git
it wont remove the /usr/bin/git
but when you run git
in terminal it will point to /usr/local/git/bin/git
Upvotes: 1
Reputation: 1325337
You need to put the folder first:
export PATH=/usr/local/git/bin:$PATH
Then the new Git would show up.
But an alternative way would be:
mv /usr/bin/git /usr/bin/git.v1.8.2
ln -s /usr/local/git /usr/bin/git
Upvotes: 0