4

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?

Community
  • 1
  • 1
UlfR
  • 4,175
  • 29
  • 45

1 Answers1

3

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"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • All those things are already in place (obviously since its working when I put the same thing in `/usr/local/bin/` as stated in the Q). – UlfR Aug 25 '15 at 08:57
  • 2
    @UlfR then add to your path the full path of your HOME instead of ~ – VonC Aug 25 '15 at 09:03
  • That actually worked! Thanks. Why does not the `~/` notation work? – UlfR Aug 25 '15 at 09:17