Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set google-chrome as git default browser

I want GIT to open the help pages in Chrome browser by default though the Windows 7 default browser is IE which I can't change for other reasons. I have added the following to the git config file.

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

But it still opens IE browser. In git's bash environment it gives the message "Launching default browser to display HTML ...". On Git Gui, it throws a lengthier message

The browser chrome is not available as 'C:/Program Files (x86)/Google/Chrome/Application/'.
The browser chrome is not available as 'C:/Program Files (x86)/Google/Chrome/Application/'.
    while executing
"exec {C:/Program Files (x86)/Git/bin/sh.exe} {C:/Program Files (x86)/Git/libexec/git-core/git-web--browse} {file:C:/Program Files (x86)/Git/doc/git/ht..."
    ("eval" body line 1)
    invoked from within
"eval exec $opt $cmdp $args"
    (procedure "git" line 23)
    invoked from within
"git "web--browse" $url"
    (procedure "start_browser" line 2)
    invoked from within
"start_browser {file:C:/Program Files (x86)/Git/doc/git/html/index.html}"
    (menu invoke)

Could someone help me resolve this?

EDIT: Also tried

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

Now I am able to open online documentation in chrome from Git Gui. But it does not work in git bash.

like image 415
Kiran Mohan Avatar asked Nov 11 '13 13:11

Kiran Mohan


People also ask

How do I make Chrome my default browser in Linux?

Making Chrome the Default BrowserIn the Settings menu, click on Details 🡪 Default Applications. In the Default Applications menu, navigate to the “Web” category and select Google Chrome.

How do I set Chrome as my default browser in Windows 10?

Select Start > Settings > Apps > Default apps.


1 Answers

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
like image 123
Ash Wilson Avatar answered Sep 18 '22 19:09

Ash Wilson