开发者

Why does "Git help <command>" not launch html help in my browser, like it says it should?

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开发者_运维知识库.


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.


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.


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.


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


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.


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.


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...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜