Reputation: 12481
I have git-tf in my path but Git doesn't appear to see it. My understanding is that git should find plugins/extensions with names like git-xxxx
in your path and let you execute them using git xxxx
.
This is on a Mac running El Capitan (10.11.12).
$ type git-tf
git-tf is hashed (/Users/chris/Development/git-tf/git-tf)
$ which git-tf
$ git-tf --version
git-tf version 2.0.3.20131219
$ which git
/usr/bin/git
$ git --version
git version 2.5.4 (Apple Git-61)
$ git tf
git: 'tf' is not a git command. See 'git --help'.
Did you mean this?
tag
$
Someone requested I print out my $PATH:
$ echo $PATH | tr ":" "\n"
~/bin
~/Development/git-tf
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
$
A co-worker is on Yosemite and is not seeing the problem. I asked him to run the same commands and his output is below. Note the output from which git-tf
:
$ type git-tf
git-tf is hashed (/usr/local/git-tfs/git-tf)
$ which git-tf
/usr/local/git-tfs/git-tf
$ git-tf --version
git-tf version 2.0.3.20131219
$ which git
/usr/local/git/bin/git
$ git --version
git version 1.8.4.2
$ git tf
usage: git-tf [--version] [--help] [--quiet|-q|--verbose] [<command...>]
The git-tf commands are:
help Displays usage information
clone Initializes a git repository from a TFS path
configure Configures an existing git repository to add to TFS
checkin Checks in changes to a TFS folder
fetch Fetch the latest code from TFS into FETCH_HEAD
pull Pulls the latest code from TFS and merge/rebase the changes into master
shelve Shelves the changes to a TFS folder
shelvesets Lists the shelvesets available on the server. Provides a way to delete shelvesets
unshelve Unshelves a shelveset from TFS into the repository
$
Upvotes: 1
Views: 377
Reputation: 18869
Please see Dan Lowe's answer above about using the complete path for the directory containing the custom git command instead of abbreivating it with '~'
(Leaving the following intact since it has a few niceties like greadlink)
I was able to reproduce the problem on OSX 10.8 with zsh (and find a work-around).
# Make a directory to store the git-tf custom git command/extension
$ mkdir -p ~/Development/git-tf
$ cat ~/Development/git-tf/git-tf #! /usr/bin/env bash
echo "Hello, Imma git command!"
$ chmod +x ~/Development/git-tf/git-tf
$ export PATH="$PATH:~/Development/git-tf"
# Confirm that it is indeed in the PATH
$ echo $PATH | tr ":" "\n" | grep tf
$ git tf
git: 'tf' is not a git command. See 'git --help'.
Did you mean this?
tag
Nope, doesn't work
# Find out the location of the git installation
$ brew install coreutils # to get GNU readlink which support '-f'
$ dirname $(dirname $(greadlink -f $(which git)))
$ cd $(!!)/libexec/git-core
$ cp ~/Development/git-tf/git-tf .
$ git tf
Hello, Imma git command!
Upvotes: 2
Reputation: 56637
Git is not able to resolve commands in the path if the relevant path component uses shell shorthand like ~
. You will need to change
~/Development/git-tf
to one of these instead:
/Users/chris/Development/git-tf
$HOME/Development/git-tf
(tested on El Capitan using bash.)
Upvotes: 4