I'm using git on a shared hosting plan which runs a Linux distribution. Because it's shared, I don't have access to sudo
. The machine already has git version 1.7.1
installed in /usr/bin/
, but this version is rather prehistoric at this point. I've already used make install
to get the current version 2.14.1
, which is in ~/git-2.14.1/
. As detailed by this answer, I can access the correct version of git from the command line like so:
$ git --version
git version 2.14.1
which was a simple change to the $PATH
variable, in the ~/.bash_profile
, so I can use git just fine.
I have a list of shortcuts in my ~/.gitconfig
file that make git much faster for me to use:
[alias]
co = checkout
st = status
ci = commit
... etc etc etc
When I invoke these (e.g. git st
), I get the results from the wrong version of git. It goes back to 1.7.1
. If I type out the full command (e.g. git status
), it uses the correct version of git.
I also have these commands in my ~./bashrc
:
git () {
case "$*" in
st* ) shift 1; command ~/git-2.14.1/git status "$@" ;;
* ) shift 1; command ~/git-2.14.1/git "$@" ;;
esac
}
Which I have source
-ed since writing.
I have also tried:
alias git="~/git-2.14.1/git"
To no avail.
Is there a work-around that would allow me to use these shortcuts with my preferred version of git? I am imagining a way to hide the config file from the other version by redirecting the pointer to a different location, but I have no knowledge of the existence of any such pointer.
Alternatively, is there a way to totally disable the previous version of git without root
access?