UlfR
UlfR

Reputation: 4395

Could I extend git functionality in my ~/bin/ directory?

As stated in numerous posts like this you could extend git by placing a program/script in your PATH. I get it working if I place my script in for example /usr/local/bin/. But I what to add commands without being root, but if if put it in ~/bin/ it will not be found.

~/bin/ is in my PATH since its added in my .bashrc like this:

export PATH="${PATH}:~/bin"

I got other stuff as well in my ~/bin/ that I use regularly so the PATH-thing is working for other things!

Is there something I'm missing or doing wrong here?

Upvotes: 4

Views: 61

Answers (1)

VonC
VonC

Reputation: 1325996

The only missing piece would be the naming convention:

git my-custom-made-extension ... → git-my-custom-made-extension

That means you need to have an executable file ~/bin/git-my-custom-made-extension (no extension, chmod 755)

Plus, don't rely on ~: the git shell which will execute the script might not have the same ~ as the user who owns the script. PATH should include the full path of the home.

See "Shell variable expansion in git config"

Upvotes: 3

Related Questions