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?

1 Answer 1

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"

Sign up to request clarification or add additional context in comments.

3 Comments

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 then add to your path the full path of your HOME instead of ~
That actually worked! Thanks. Why does not the ~/ notation work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.