Command attempted: hub browse
or hub browse my-repo-here
What happened:
A new window with sync disabled and default toolbar configuration and a single tab has opened in FF.
More info:
Instead of this, I would have loved it to open in the existing Firefox window, or at least in the same session.
silviu@silviu-Inspiron-3537 ~> hub version
git version 2.25.1
hub version 2.14.2
Ubuntu 20.04.
Thank you.
Hi! On Linux platforms, hub tries to find one of the following executables and pass a URL argument to it: https://github.com/github/hub/blob/93537d457500c1d9f2e5671b9b9b1ebf90a55668/utils/utils.go#L52-L55
So hub basically just invokes your system browser utility with a URL. That utility controls how Firefox is opened, not hub.
So to fix your experience, you should find or create a utility that does the right thing for you when invoked from the command-line with a URL argument, and configure hub to use it via the BROWSER environment variable:
export BROWSER='my-util --some-flag'
hub browse ...
Good luck! Let us know the solution when you find it.
Running xdg-open "https://dgg.gg"
works well (does not start a separate session). Setting the BROWSER
variable to 'xdg-open' does not make the hub browse
command work. I have seen that the separate session is started by other commands in my Ubuntu installation too.
I do not know Go and I do not know how does the exec.ExecPath
function work, so I do not know what to do next.
Thank you.
@silviubogan How did you install hub?
Can you run HUB_VERBOSE=1 hub browse
and check in the verbose output the command which was used to open the browser? It should look like: xdg-open https://...
So if running xdg-open
directly works flawlessly for you, but not when xdg-open
is run by the hub process, then I'm really stumped and not sure what to suggest here. The only thing I can think of is that the culprit might be if you installed hub as a Snap?
@mislav I installed hub using: $ sudo snap install hub --classic
.
The output for HUB_VERBOSE=1 hub browse
is:
silviu@silviu-Inspiron-3537 /m/s/S/L/T/i/react (master)>
HUB_VERBOSE=1 hub browse
$ git rev-parse -q --git-dir
$ git symbolic-ref HEAD
$ git remote -v
$ git config --get-all hub.host
$ git symbolic-ref refs/remotes/origin/HEAD
$ git symbolic-ref HEAD
$ git config push.default
$ git rev-parse -q --git-path refs/remotes/origin/master
$ git symbolic-ref refs/remotes/origin/HEAD
$ /usr/bin/xdg-open https://github.com/facebook/react
and has the same effect of opening a separate FF session.
Thank you.
@silviubogan Okay, so you did install hub as a snap.
There are many subtle problems with containerized apps, this being one of them. It's clear that xdg-open
as being invoked from within the snap behaves differently than when you invoke xdg-open
from the host system. I don't know how to work around it.
I don't think it's hub's responsibility to fix this, since the problem is caused by how hub is packaged within a snap. I'm going to close this again, and you might want to ask on https://forum.snapcraft.io/. Please share with us if you've found a solution!
I started using GitHub CLI (https://cli.github.com/manual/gh_repo_view) and it works well.
I hope this helps!
Thank you.