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

8

14

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.

Hurl answered 22/7, 2011 at 14:46 Comment(7)
Does git help <cmd> output Launching default browser to display HTML ... at least?Arboretum
What is your default browser set to?Dekeles
Stab in the dark: I've always done git <cmd> --help. Does that work?Polemic
Ok ... you're not going to believe this. but yes that worked... What's more the normal way now works. Go figure?Hurl
@Joshua FWIW default browser is FF4 on both machines.Hurl
@Rory, just to clarify, using git <cmd> --help worked, but After that, git help <cmd> works too?Polemic
Related: https://mcmap.net/q/830079/-git-fatal-failed-to-launch-browser/127465Usury
H
1

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

Hurl answered 22/8, 2011 at 18:21 Comment(0)
I
8

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.

Immunotherapy answered 6/7, 2014 at 18:53 Comment(1)
So in other words, you didn't have any default application for HTML files, right? It should ask you to select an application to open the specified file type automatically. Anyway, it's enough to just open Control panel > Default Programs > Associate a file type or protocol with a program > find .html and assign any program you want to use to open such file type.Samul
E
4

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.

Estivation answered 22/7, 2011 at 17:43 Comment(0)
E
3

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.

Endearment answered 5/11, 2018 at 16:30 Comment(1)
I don't like this solution, because it fiddles with browser names and maybe even paths. I just used git config --global help.format html to set my help format. git help then uses my default browser.Nureyev
F
2

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.

Footpad answered 14/9, 2012 at 10:7 Comment(1)
Note, I've tried setting git config --global help.format html to no avail. This is with git 1.7.11 installed from the developer full install, worked with git 1.7.8 before I upgraded (also from the developer full install).Footpad
H
1

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

Hurl answered 22/8, 2011 at 18:21 Comment(0)
P
1

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.

Pitarys answered 25/11, 2019 at 2:39 Comment(0)
P
0

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

Polemic answered 22/7, 2011 at 15:49 Comment(3)
Oops, sorry about that I appeared to accept the wrong answer. Corrected :)Hurl
Not that it was a very good answer. I just threw a dart into the night and it hit something. Too bad I don't even know what I hit...Polemic
So it's happened again and now this tip doesn't appear to help :(Hurl
M
0

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.

Mckibben answered 11/10, 2017 at 5:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.