12

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.

Jim Counts
  • 12,535
  • 9
  • 45
  • 63
Rory Becker
  • 15,551
  • 16
  • 69
  • 94

8 Answers8

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.

Levan
  • 81
  • 1
  • 1
  • 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. – David Ferenczy Rogožan Nov 05 '18 at 15:59
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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
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.

tul
  • 1,709
  • 16
  • 15
  • 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). – tul Sep 14 '12 at 10:09
2

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.

David Ferenczy Rogožan
  • 23,966
  • 9
  • 79
  • 68
  • 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. – Neonit Aug 06 '19 at 14:58
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.

Brad
  • 11
  • 5
1

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

Rory Becker
  • 15,551
  • 16
  • 69
  • 94
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.

Edison
  • 11,881
  • 5
  • 42
  • 50
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...

Andy
  • 44,610
  • 13
  • 70
  • 69