I want GIT默认情况下在 Chrome 浏览器中打开帮助页面,尽管 Windows 7 默认浏览器是 IE,但由于其他原因我无法更改。我已将以下内容添加到 git 配置文件中。
[web]
browser = chrome
[browser "chrome"]
cmd = C:/Program Files (x86)/Google/Chrome/Application/chrome.exe
path = C:/Program Files (x86)/Google/Chrome/Application/
但仍然打开IE浏览器。在 git 的 bash 环境中它给出了消息"Launching default browser to display HTML ..."
。在 Git Gui 上,它会抛出更长的消息
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)
有人可以帮我解决这个问题吗?
EDIT:也尝试过
[web]
browser = chrome
[browser "chrome"]
path = C:/Program Files (x86)/Google/Chrome/Application/chrome.exe
现在我可以从 Git Gui 在 chrome 中打开在线文档。但它在 git bash 中不起作用。
经过一番尝试和错误后,我找到了一个可行的解决方案。我的.gitconfig
Git bash(Windows 10,64 位,Git 版本 2.13.1.windows.2)使用的内容如下所示:
[web]
browser = "chrome"
[browser "chrome"]
path = C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe
与执行以下两条命令效果相同:
-
git config --global web.browser chrome
然后执行
git config --global web.browser.chrome.path C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe
请注意双反斜杠,并且尽管路径包含空格,但既没有使用单引号也没有使用双引号。设置更像unix的值/C/Program Files (x86)/Google/Chrome/Application/chrome.exe
也确实有效。从我的角度来看,设置一个值web.browser.chrome.cmd
似乎被忽略如果path
也被设定。定义google-chrome
相反似乎也是有效的,因为 git 仍然打开了 Google Chrome,确认可以在此处找到的信息:https://git-scm.com/docs/git-web--browse.html https://git-scm.com/docs/git-web--browse.html.
因此,回答最初的问题:如果您想使用类似 windows 的值web.browser.chrome.path
,确保使用双反斜杠。如果你可以接受更类似于 Unix 的值使用/C/Program Files (x86)/Google/Chrome/Application/chrome.exe
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)