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

Viewed 6093

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.

8 Answers

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.

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.

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.

Related