7

I have newly installed Git for Windows on Windows 8.1. In Git Bash, when I run help commands like git help diff or git diff --help the corresponding .html help file will open in the program I have associated with .html file extensions, regardless of my help.browser and web.browser Git configuration properties.

My Git configuration:

git config --global help.browser chrome    
git config --global web.browser chrome    

My Windows Default Programs file extension association: .html opens with Sublime Text

So, git diff --help in Git Bash opens git-diff.html in Sublime Text. I want it to open in Chrome.

The source of this might be another problem: when I do the command git web--browse URL/FILE (e.g. git web--browse index.html) I get

$ The browser chrome is not available as 'chrome'

git-web--browse documentation: http://git-scm.com/docs/git-web--browse.html

I found this question: How can I configure git help to use Firefox? but that didn't work for me (maybe because I'm running Windows). I tried this:

git config --global help.browser chr
git config --global browser.chr.cmd "start chrome"

Does anyone know of a solution that will allow me to open the help files in Chrome instead of Sublime Text?

Community
  • 1
  • 1
David Groomes
  • 2,303
  • 1
  • 21
  • 23

4 Answers4

6

It looks like there is no Git configuration that makes help commands open in the browser. Any Git configuration is overridden by Windows' .html filetype association. For explanation see this Google Group thread at msysGit https://groups.google.com/d/msg/msysgit/bBVP3DKyKzc/fpzK8moJXOgJ

David Groomes
  • 2,303
  • 1
  • 21
  • 23
4

I had the same problem, also using Git for Windows running Windows 8.1. The following worked for me:

Change the app that Windows uses by default for files of type .html and .htm. For instructions on that see: http://windows.microsoft.com/en-us/windows-8/choose-programs-windows-uses-default .

aap
  • 897
  • 11
  • 15
0

Set browser.chrome.path explicitly:

browser..path

You can explicitly provide a full path to your preferred browser by setting the configuration variable browser..path. For example, you can configure the absolute path to firefox by setting browser.firefox.path. Otherwise, git web--browse assumes the tool is available in PATH.

mockinterface
  • 14,452
  • 5
  • 28
  • 49
  • I tried it but the help file still opened in Sublime Text, not Chrome. Now I have this property: browser.chrome.path=C:\Program Files (x86)\Google\Chrome\Application Which is the path to chrome.exe – David Groomes Feb 01 '14 at 06:55
  • You need to point it to the actual executable not the directory, as in: browser.chrome.path=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe – mockinterface Feb 01 '14 at 07:08
  • 1
    Yep you're absolutely right. I fixed this but it still doesn't work. I actually elevated this to a mailing list and someone pointed me to C code that describes why this is happening. It's a bug. I did not officially report the issue so it's not about to be fixed. Thanks, – David Groomes Feb 24 '14 at 04:05
  • 1
    @dgtc It'll be excellent if you provide your own answer, with the ref to the mailing list or the bugtracker number, and accept your own answer. That's the SO way. – mockinterface Feb 24 '14 at 09:17
0

Use the following method to solve the problem(running on windows10): Find the default app settings, click 'choose default apps by file type' and change the default app for .htm and .html to the app you want. No need to config the git.

choose default app

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Dong
  • 36
  • 2