我的道路上有吉特-tf,但吉特似乎没看见。我的理解是,git应该在您的路径中找到名为git-xxxx的插件/扩展,并让您使用git xxxx来执行它们。
这是在运行El Capitan (10.11.12)的Mac上。
$ 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
$ 有人要求我打印我的$PATH:
$ echo $PATH | tr ":" "\n"
~/bin
~/Development/git-tf
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
$ 一位同事正在约塞米蒂工作,并没有看到问题所在。我让他运行相同的命令,他的输出如下。注意来自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
$发布于 2015-12-14 18:55:06
如果相关路径组件使用shell速记(如~ ),则Git无法解析路径中的命令。你需要改变
~/Development/git-tf取而代之的是其中之一:
/Users/chris/Development/git-tf
$HOME/Development/git-tf(在El Capitan上使用bash进行测试)
发布于 2015-12-14 20:18:21
请参阅Dan上面关于使用包含自定义git命令的目录的完整路径的答案,而不是用'~'缩写它
(保留以下内容,因为它有一些细节,如greadlink)
我用zsh在OSX10.8上重现了这个问题(并找到了解决办法)。
创建自定义命令
# 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不,不管用
工作(将自定义命令复制到git安装文件夹)
# 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!https://stackoverflow.com/questions/34273992
复制相似问题