Changing the location of git installation on linux

孤街浪徒 提交于 2019-12-11 04:52:12

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/31728941/changing-the-location-of-git-installation-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!