首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Git插件不工作

Git插件不工作
EN

Stack Overflow用户
提问于 2015-12-14 18:23:01
回答 2查看 309关注 0票数 1

我的道路上有吉特-tf,但吉特似乎没看见。我的理解是,git应该在您的路径中找到名为git-xxxx的插件/扩展,并让您使用git xxxx来执行它们。

这是在运行El Capitan (10.11.12)的Mac上。

代码语言:javascript
复制
$ 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:

代码语言:javascript
复制
$ echo $PATH | tr ":" "\n"
~/bin
~/Development/git-tf
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
$ 

一位同事正在约塞米蒂工作,并没有看到问题所在。我让他运行相同的命令,他的输出如下。注意来自which git-tf的输出

代码语言:javascript
复制
$ 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
$
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-12-14 18:55:06

如果相关路径组件使用shell速记(如~ ),则Git无法解析路径中的命令。你需要改变

代码语言:javascript
复制
~/Development/git-tf

取而代之的是其中之一:

代码语言:javascript
复制
/Users/chris/Development/git-tf

$HOME/Development/git-tf

(在El Capitan上使用bash进行测试)

票数 4
EN

Stack Overflow用户

发布于 2015-12-14 20:18:21

请参阅Dan上面关于使用包含自定义git命令的目录的完整路径的答案,而不是用'~'缩写它

(保留以下内容,因为它有一些细节,如greadlink)

我用zsh在OSX10.8上重现了这个问题(并找到了解决办法)。

创建自定义命令

代码语言:javascript
复制
# 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!"

先决条件,使其可执行并将其添加到路径中。

代码语言:javascript
复制
$ 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安装文件夹)

代码语言:javascript
复制
# 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!
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34273992

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档