Git custom commands from PATH not working

Your PATH contains unexpanded ~/bin. Your shell understands what ~/ means but git apparently doesn't. You should include full path to ~/bin in your PATH.

If you used PATH=~/"bin:${PATH}" instead of PATH="~/bin:${PATH}", tilde expansion would occur and PATH would store the expanded path. But there's a problem with :~/bin: inside [[ ]]. Not quoting tilde is not the only condition (see "Tilde Expansion" in man 1 bash), this makes expanding :~/bin: difficult. And you need to expand it to test against the full path in PATH.

It's easier to use $HOME:

[[ ":$PATH:" != *":$HOME/bin:"* ]] && PATH="$HOME/bin:${PATH}"
export PATH

$HOME gets expanded before the whole string is assigned to the PATH variable. This means PATH now contains the full path to your $HOME/bin. git will understand this path.

Tags:

Linux

Git

Bash