为什么“Git help”没有在我的浏览器中启动 html 帮助,就像它所说的那样?

发布于 2024-11-25 20:15:19 字数 397 浏览 2 评论 0原文

我真的很享受使用 git 的时光。

我在 2 台机器上运行,我认为设置非常相似

在我的笔记本电脑上

当我从 CLI 中输入“Git help SomeCommand”时,我的笔记本电脑会启动 html 帮助在我的浏览器中,我可以自由地阅读我询问的任何帮助元素。

在我的桌面上

CLI 的响应就好像要执行相同的操作,但没有切换到浏览器,也没有启动任何帮助

我该怎么做才能在桌面上恢复帮助?

注意:我通过 console2 运行 bash shell,但这个问题似乎同样会影响通过资源管理器中的上下文菜单运行的默认 bash shell。

I am really enjoying my time with git.

I'm operating on 2 machines with what I thought were pretty similar setups

On my Laptop

When I type "Git help SomeCommand" from the CLI, my laptop launches the html help in my browser and I am free to read up on whatever help element I asked about.

On my Desktop

The CLI responds as if is is going to do the same, but no browser is switched to and no help is launched

What can I do to get my help back on my desktop?

Note: I'm running the bash shell through console2, but this problem appears to affect the default bash shell run via the context menu in explorer just as much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

平定天下 2024-12-02 20:15:19

我最近也遇到了同样的问题,浏览器无法启动。
我在 Windows 8.1 上运行 Git 1.9.2.msysgit.0。默认浏览器 - Chrome。

上述解决方案都不适合我。但我只是在资源管理器中转到该 html 文件,然后双击它。 Windows 然后问我用什么应用程序打开它,我选择了 chrome。

现在,常用的 git 命令可以工作并在 Chrome 中打开帮助 html 文件。

I just recently had the same problem, browser wouldn't launch.
I'm running Git 1.9.2.msysgit.0 on Windows 8.1. Default browser - Chrome.

None of the solutions above worked for me. But I simply went to the html file in the explorer, and double-clicked it. Windows then asked me what app to use to open it, and I chose chrome.

Now usual git commands work and open the help html files in Chrome.

魄砕の薆 2024-12-02 20:15:19

正如 msysgit 错误报告 445 中所述:

Git 有自己的工具,名为“git web--browse”,可以调用网络浏览器。

将环境 GIT_TRACE 设置为 1 以查看启动了哪些进程以及启动了哪些进程
命令行。

这样可以帮助调试问题。

临时解决方法(对您的情况可能无效)是:

作为临时解决方法,可以将 \doc 中的所有 git-.html 重命名为 git.html \git\html 目录。

git; Andy 建议的 --help 似乎有所帮助,并且必须“重置”某些东西。

As mentioned in the msysgit bug report 445:

Git has it's own tool called "git web--browse" that invokes the web-browser.

Set the environment GIT_TRACE to 1 to see what processes are started, and with what
command-lines.

So that can help debugging the issue.

A temporary workaround (which might not be effective in your case) was:

As temporary workaround one can rename all git-<command>.html to git<command>.html in his <Git>\doc\git\html directory.

The git <cmd> --help suggested by Andy seems to have helped though, and must have "reset" something.

倾城°AllureLove 2024-12-02 20:15:19

您可以配置 Web 浏览器来打开 Git 的帮助文件,而与分配用于打开 .html 文件的系统默认程序无关。

检查它是否已设置以及设置为什么值,只需运行:

git config web.browser

要为所有存储库(例如 chrome全局设置它,请运行

git config --global web.browser chrome

:还可以为每个存储库设置它,在这种情况下,在存储库内运行它并且不使用--global参数:

git config web.browser chrome

如果指定的浏览器的可执行文件位于中,它会自动工作>路径。如果不是,您可以手动设置:

git config browser.<name>.path <path-to-browser-executable>

...对于 Chrome 浏览器,它可能如下所示:

git config browser.chrome.path "c:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

请参阅 文档 了解详细信息。

You can configure a web browser to be used to open Git's help files independently of the system's default program assigned to open .html files.

To check if it's set and to what value, simply run:

git config web.browser

To set it globally for all repositories, for example to chrome, run:

git config --global web.browser chrome

You can also set it per-repository, in that case run it inside a repository and without the --global parameter:

git config web.browser chrome

It works automatically if the specified browser's executable is in PATH. If it's not, you may set it manually:

git config browser.<name>.path <path-to-browser-executable>

...so for Chrome browser, it may look like the following:

git config browser.chrome.path "c:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

See the documentation for details.

最单纯的乌龟 2024-12-02 20:15:19

我目前遇到这个问题,并且 git--help 技术无法修复它。

然而,我发现执行

git help -w

实际上会在浏览器中打开帮助文件,所以这是一个有用的解决方法。

I have this problem currently, and the git <cmd> --help technique doesn't fix it.

I have however found that doing

git help -w <cmd>

Will actually open the help file in the browser, so this is a useful workaround.

左秋 2024-12-02 20:15:19

当我升级到 msysgit 的最新版本(1.7.3 的 1.7.6)时,这个错误似乎消失了

It seems that this bug went away when I upgraded to the latest version of msysgit (1.7.6 from 1.7.3)

属性 2024-12-02 20:15:19

我遇到了同样的问题(浏览器无法打开),然后我意识到这可能是因为我们工作时的笔记本电脑是“最低特权访问”,这意味着我们以标准用户身份登录 Windows 系统。但对于开发工作,包括我正在执行 git 命令的命令窗口,我以具有本地管理员权限的不同用户身份运行。所以它实际上是在打开 Chrome 浏览器,只是不在我可以看到它的“登录”桌面会话中。

为了解决这个问题,我以该用户身份运行了另一个 Chrome 副本(通过按住 Shift 键并右键单击 Chrome.exe 并以与运行命令提示符相同的特权用户身份运行它)。当 Chrome 实例在我的桌面上运行后,我返回命令提示符并重新运行“git help”,它在该浏览器实例中正确启动了一个新选项卡,该选项卡与我的命令提示符是同一用户运行的。

I had the same problem (browser wouldn't open), then I realized it's probably because our laptops at work are "least privileged access", meaning we're logged into our Windows systems as standard users. But for development work, including the command window I'm doing git commands from, I'm running as a different user who has local admin privileges. So it actually was opening the Chrome browser, just not in my "logged in" desktop session where I could see it.

To work around this, I ran another copy of Chrome as that user (by Shift-Right clicking on Chrome.exe and running it as the same privileged user that my command prompt is running as). Once that instance of Chrome was running on my desktop, I returned to the command prompt and re-ran the "git help " and it properly launched a new tab in that instance of the browser that was running as the same user my command prompt was.

自由范儿 2024-12-02 20:15:19

在黑暗中刺伤:我总是这样做 git; --帮助。那有用吗?

编辑:供将来参考。这似乎解决了OP的问题。运行 git--help 似乎已经清除了一些东西,以便它现在按指定工作。如果我知道它是如何/为什么的话......

Stab in the dark: I've always done git <cmd> --help. Does that work?

edit: For future reference. This appears to be what fixed the OP's problem. Running git <cmd> --help seemed to have cleared out something so that it works as specified now. If only I knew the how/why of it...

装迷糊 2024-12-02 20:15:19

此设置是最新的、有效的且符合惯例。

这很可能是因为您使用的是 MacOS 附带的默认 Git(称为 Apple Git),该版本已过时。

运行 git --version 并检查 Git 网站。

使用 brew install git 安装 Git。

为了确保 Homebrew 安装优先于 MacOS 安装,请将 usr/local/bin 路径添加到 .zshrc 或 .bash_profile 中。 导出 PATH=/usr/local/bin:$PATH。 (*顺便说一句,您也应该使用此路径来使用 Python 3,而不是 MacOS Python 2.7 和许多其他应用程序)。

要确保所有这些都已激活,请执行 source ~/.zshrcsource ~/.bash_profile。或者直接重新启动终端。

测试一下。 git help -w 提交。将打开一个浏览器窗口。

This set up is current, working and the convention.

It's most likely because you are using the default Git that comes with MacOS called Apple Git which is outdated.

run git --version and check against the Git website.

Install Git using brew install git.

To make sure Homebrew installs take precedence over MacOS installs add the usr/local/bin path to your .zshrc or .bash_profile. export PATH=/usr/local/bin:$PATH. (*Btw, you should use this path also for using Python 3 instead of MacOS Python 2.7 and many other applications).

To make sure all of this is activated do source ~/.zshrc or source ~/.bash_profile. Or simply restart Terminal.

Test it. git help -w commit. A browser window will open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文