tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.08k stars 1.01k forks source link

:Gbrowse does not open browser and only shows URL #108

Closed AndrewRayCode closed 13 years ago

AndrewRayCode commented 13 years ago

I'm not sure if this is a configuraiton issue with VIM or my browser, but if I type :Gbrowse it just shows the URL on the ruler line.

I tried git config --global web.browser firefox and also tried chrome but I get the same result. I just cloned and that didn't fix it.

tpope commented 13 years ago

Can you try git web--browse http://google.com/ and see if that works?

AndrewRayCode commented 13 years ago

That gives me The browser firefox is not available as 'firefox'.

I was able to get it to work by following the answer here:

http://stackoverflow.com/questions/4947915/how-can-i-configure-git-help-to-use-firefox

git config --global web.browser ff
git config --global browser.ff.cmd "open -a Firefox.app"

But is that the right solution?

tpope commented 13 years ago

If you're on OS X, you should probably just edit ~/.gitconfig and remove all traces of the browser stuff. Git on OS X defaults to open.

AndrewRayCode commented 13 years ago

When I remove the browser lines (only lines remaining are name and email) it goes back to the original behavior. I am indeed on OS X. I wonder if I need to upgrade git, I'm using 1.7.5.3 right now

tpope commented 13 years ago

What is "the original behavior"? Take fugitive out of the question entirely until you get git web--browse working. That Git version is plenty new enough.

AndrewRayCode commented 13 years ago

With only name and email in my .gitconfig, running git web--browse http://google.com/ returns No known browser available. If I add:

[web]
    browser = firefox

I get The browser firefox is not available as 'firefox'.

Only when I add:

[web]
    browser = ff
[browser "firefox"]
    path = /Applications/Firefox.app/Contents/MacOS/firefox-bin
[browser "ff"]
    cmd = open -a Firefox.app

do I see the correct behavior.

tpope commented 13 years ago

Are you just running in Terminal.app? What is the output of the following?

echo $SECURITYSESSIONID
echo $TERM_PROGRAM
AndrewRayCode commented 13 years ago

no, I'm iTerm2

$ echo $SECURITYSESSIONID

$ echo $TERM_PROGRAM
    iTerm.app

Edit: It works in terminal without that honkey bullshit in my gitconfig. Interesting.

tpope commented 13 years ago

Well that explains it. No idea why $SECURITYSESSIONID would be blank though. Are you doing something weird like sshing into your own box or running in screen/tmux?

You can work around this in a much less contrived matter with git config --global web.browser open.

AndrewRayCode commented 13 years ago

Nope, I'm just running iTerm2 from spotlight. Not sshing anywhere and not using any multiplexers ... that I know about.

ivanoats commented 13 years ago

OK, I'm getting this behavior too. I think for different reasons. I on an Mac and have elinks installed via homebrew. Also, I have the manpageview.vim plugin installed ( https://github.com/vim-scripts/ManPageView )

git web--browse http://google.com/ opens up google in elinks

using git config --global web.browser open is a good solution that works for me.

soupmatt commented 12 years ago

@ivanoats's solution worked for me as well on Mac OS X with MacVim.

benwoodward commented 12 years ago

thanks @ivanoats, solved my issue too.

AndrewRayCode commented 12 years ago

@tpope actually I'm dumb, I think iTerm2 (not regular terminal) counts as a multiplexer - letting you do splits and stuff. if I run in normal terminal the command works fine, but in iTerm2 I get the error. Your solution with open still fixes it, but is that the right solution?

tpope commented 12 years ago

@DelvarWorld for the record, iTerm2 is my terminal of choice and I've never had an issue.

suan commented 12 years ago

I have this exact problem too, and @ivanoats solution fixes it. Would be nice if we could pinpoint the root cause as it seems its a common problem for people running OSX and iTerm2, or at least add a warning in the README :Gbrowse section

tpope commented 12 years ago

Yeah, this issue is turning out to be surprisingly popular. @suan, can you check and see if $SECURITYSESSIONID is set for you in Terminal.app?

suan commented 12 years ago

@tpope It seems to be empty in both my terminal.app and iTerm2.

tpope commented 12 years ago

Googling suggests $SECURITYSESSIONID might have been [dropped from OS X 10.6](http:// kerneltrap.org/mailarchive/git/2009/9/14/11795), but this contradicts my own experience on 10.7. What version is everyone else running?

ivanoats commented 12 years ago
11:40:ivan@thuja:c4c [git:master]  → sw_vers
ProductName:    Mac OS X
ProductVersion: 10.7.3
BuildVersion:   11D50
11:41:ivan@thuja:c4c [git:master]  → uname -a
Darwin thuja 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
11:41:ivan@thuja:c4c [git:master]  → echo $SECURITYSESSIONID
186b4
11:43:ivan@thuja:c4c [git:master]  → echo $TERM_PROGRAM
iTerm.app
tpope commented 12 years ago

@ivanoats yours is an especially mysterious case. Looking at the source to git-web--browse, open gets top priority if $SECURITYSESSIONID is set. Your sure it still uses elinks if you kill all browser config in your Git config?

You may have to throw some debug statements into git-web--browse and see for yourself what's happening. At least you've got a solid strategy.

suan commented 12 years ago

At least in my case, since $SECURITYSESSIONID isn't set in either terminal.app or iTerm, but :Gbrowse and git web--browse works in terminal.app, the problem seems to be iTerm-specific.

tpope commented 12 years ago

I bet it doesn't work in MacVim either. Or any other 3rd party terminals. There is a workaround for Terminal.app.

hovsater commented 11 years ago

I'm sure the :Gbrowse command worked perfectly for me in iTerm2 up until recently. Now the git web--browse simply return "No known browser available." in Iterm2. In Terminal it still works though.

By looking at the source for git web--browse this seems to be due to $TERM_PROGRAM reporting "Apple_Terminal" in Terminal but "iTerm.app" in iTerm2. See https://github.com/git/git/blob/master/git-web--browse.sh#L121,L125.

I solved the issue in iTerm2 by running git config --global web.browser open. I cannot explain why git web--browse worked initially and then stopped working but I guess I'll have to live with that mystery.

deleteme commented 11 years ago

Confirming that setting git config --global web.browser open fixes the issue for me in iTerm2 and macvim when launched from iTerm2.

wilmoore commented 11 years ago

I just hit this issue as well after previously having no issues. Turns out, in my case, iTerm2 had actually crashed; however, was still somehow running. It wasn't until I closed the crash reporter window and restarted iTerm2 that all went back to normal.

Hope this helps someone else having this issue.

guneysus commented 10 years ago

I am having same issue, when I init a initialize a repo on local and add tracking to Github branch.

tpope commented 10 years ago

One possible alternative would be to swap out git web--browse for a call to netrw#NetrwBrowseX().

JasonGhent commented 8 years ago

Supposing one cannot get the browser to open with GBlame, and the URL is not showing anywhere, is there any way to perhaps set

git config --global web.browser ff
git config --global browser.ff.cmd "open -a Firefox.app"

differently, where it would send the URL to pbcopy or output to the status bar below vim or something? I'm perfectly content to open the browser myself as long as I can grab the URL fugitive is trying to send to git web--browse

tpope commented 8 years ago

Well it won't work now that we're using netrw, but for posterity, yes, you could do something like that if you override a browser like dillo that doesn't take arguments.

JarenGlover commented 8 years ago

When I installed vim using homebrew these solved all my troubles ... doesn't seem to like the native vim version from 2010 ...thanks for help from @JamshedVesuna