且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Linux上更改git安装的位置

更新时间:2022-12-04 21:13:08

您必须确保调用正确的可执行文件.这可以通过显式调用/usr/src/git/bin/git 而不是 git 来完成.当然,这总是很烦人,因此您可以通过添加以下行来使 git 成为该路径的别名

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

添加到您的 .bashrc 中,或通过添加以下行将目录/usr/src/git/bin 添加到您的二进制搜索路径中

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"

要测试其他git安装是否在正确的位置搜索了核心二进制文件,可以检查 git --exec-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.