Git:'rebase'不是git命令.看'git --help'

use*_*847 5 git macos github github-for-mac

为mac设置了github
,现在我正在尝试使用终端的git命令.

如果我尝试运行该git rebase命令,我会收到以下消息

> cd /Applications/GitHub.app/Contents/Resources/git/bin
> git rebase
git: 'rebase' is not a git command. See 'git --help'.

>git --help
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]

The most commonly used git commands are:
...
rebase     Forward-port local commits to the updated upstream head
....
Run Code Online (Sandbox Code Playgroud)

因此,从帮助输出中可以看到选项rebase存在.
我的git有什么问题?

git --version
git version 1.7.8.2
Run Code Online (Sandbox Code Playgroud)

aka*_*vel 6

对我来说,我发现要修复此错误消息(" 'rebase' is not a git command")我需要 设置Git"exec-path",或者通过命令行进行一次性使用,或者更好地通过环境变量:

export GIT_EXEC_PATH=/PATH/TO/git/libexec/git-core
Run Code Online (Sandbox Code Playgroud)


Wan*_*uta 3

您正在使用 GitHub for Mac 附带的 Git 版本。他们(即 GitHub)可能修改了二进制文件以删除 GitHub for Mac 不使用的功能。

您确实应该安装“自己的”Git。我建议使用 Homebrew:链接