how to set google-chrome as git default browser how to set google-chrome as git default browser google-chrome google-chrome

how to set google-chrome as git default browser


After a bit of trial and error, I found a working solution. My .gitconfig used by the Git bash (Windows 10, 64-bit, Git version 2.13.1.windows.2) looks like this:

[web]    browser = "chrome"[browser "chrome"]    path = C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe

Which is the same as executing the following two commands:

  1. git config --global web.browser chrome and then executing
  2. git config --global web.browser.chrome.path C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe

Please note the double backslashes and that there are neither single nor double quotes used although the path contains whitespaces. Setting the more unix-like value /C/Program Files (x86)/Google/Chrome/Application/chrome.exe does work, too. From my point of view, setting a value for web.browser.chrome.cmd seems to be ignored if path is also set. Defining google-chrome instead seems to be valid, too, because git still opened Google Chrome, confirming the information that can be found here: https://git-scm.com/docs/git-web--browse.html.

So, to answer the original question: If you want to use a windows-like value for web.browser.chrome.path, make sure to use double backslashes. If you're okay with a more unix-like value use /C/Program Files (x86)/Google/Chrome/Application/chrome.exe.


Git is expecting the config setting browser.<tool>.path to point to the executable of a recognized browser, not the containing directory. browser.<tool>.cmd is only used if the browser you specify isn't on the list of recognized browsers (of which "chrome" is one). See the git-web--browse docs for details.

Try using this in your .gitconfig instead:

[web]    browser = chrome[browser "chrome"]    path = C:/Program Files (x86)/Google/Chrome/Application/chrome.exe

If you want to customize the command line that's used to launch Chrome, you can give it a name that isn't recognized as a supported browser, and specify the command in cmd instead:

[web]    browser = specialchrome[browser "specialchrome"]    cmd = C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --new-window


On Windows 10, you would want to use backslashes. E.g. my config looks like this.

web.browser=chromebrowser.chrome.path=C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe

Also, I suggest you use the following (I presume this always ships with a git installation) to see if bash launches Chrome.

$ git help branch 

You will receive fatal errors if the help file you are trying to see does not exist. E.g. on my system, trying the following results in an error.

$ git help packsizelimitLaunching default browser to display HTML ...fatal: failed to launch browser for C:\Program Files (x86)\Git/doc/git/html//gitpacksizelimit.html

Usually, git is good with the error description. In my example, there is no gitpacksizelimit.html file at the location git checks for help files. Re-read the error and it should offer you a clue.