Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The -w flag won't open a browser from WSL #6938

Closed
lolmaus opened this issue Jan 31, 2023 · 8 comments
Closed

The -w flag won't open a browser from WSL #6938

lolmaus opened this issue Jan 31, 2023 · 8 comments
Labels
bug Something isn't working needs-user-input

Comments

@lolmaus
Copy link

lolmaus commented Jan 31, 2023

Describe the bug

I'm running gh in Ubuntu in WSL in Windows 10.

Originally, it was able to open the browser on the host OS, but now it won't.

When I do commands like gh pr create -w or gh repo view -w, it shows no error but the browser won't open a page. I have to scroll the console up, copy the URL from gh output and paste it into the browser's URL bar.

gh version 2.14.4 (2022-08-10)

gh is authenticated.

$BROWSER is empty.

wslview https://github.com/cli/cli does open a page in the broswer in the host OS successfully.

@lolmaus lolmaus added the bug Something isn't working label Jan 31, 2023
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Jan 31, 2023
@mislav
Copy link
Contributor

mislav commented Jan 31, 2023

Thanks for reporting and sorry for the nuisance.

If you run the command as GH_DEBUG=1 gh repo view -w, more information should be printed on stderr. Does the command to invoke the browser with get printed?

What if you do GH_BROWSER=wslview gh repo view -w?

@mislav mislav added needs-user-input and removed needs-triage needs to be reviewed labels Jan 31, 2023
@lolmaus
Copy link
Author

lolmaus commented Jan 31, 2023

GH_DEBUG=1 gh repo view -w:

❯ GH_DEBUG=1 gh repo view -w
[git remote -v]
[git -C . config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2023-01-31 19:29:38.258200684 +0300 MSK m=+0.017526813
* Request to https://api.github.com/graphql
* Request took 470.581539ms
Opening github.com/sibp/sibp in your browser.

Does not open, I have to copy the link manually. The link is not clickable because it misses the protocol.

@lolmaus
Copy link
Author

lolmaus commented Jan 31, 2023

What if you do GH_BROWSER=wslview gh repo view -w?

THis does work!

@lolmaus
Copy link
Author

lolmaus commented Jan 31, 2023

Should I add export GH_BROWSER=wslview to my .bashrc?

@mislav
Copy link
Contributor

mislav commented Jan 31, 2023

Yes, but I'm wondering what gh on your system defaulted to when you did not set GH_BROWSER.

You can also do: gh config set browser wslview, which is about the same as setting GH_BROWSER.

@mislav mislav closed this as completed Jan 31, 2023
@lolmaus
Copy link
Author

lolmaus commented Jan 31, 2023

It was empty.

@lolmaus
Copy link
Author

lolmaus commented Feb 1, 2023

Thank you, @mislav. 🙇‍♂️

@Jkrox
Copy link

Jkrox commented Jan 4, 2024

I was struggling on why it cannot find wslview, so if somebody has the same error like me, either because it's not installed or whatever, and you have similar WSL config.

❯ wslsys
Release Install Date: Sun Oct  1 22:25:10 -05 2023
Branch: ni_release
Build: 22621
Full Build: 22621.1.amd64fre.ni_release.220506-1250
Display Scaling: 1
Locale (Windows): en_US
Theme (Windows): dark
Uptime (Windows): 6d 1h 39m
Version (WSL): 2
Uptime (WSL): 0d 1h 25m
Release: Ubuntu 22.04.3 LTS
Kernel: Linux 5.15.133.1-microsoft-standard-WSL2
Packages: 720
IPv4 Address: 172.31.173.166
System Type (Windows): Desktop
SystemD Status: enabled

This was for me the solution:

image

and also this issue thread #826 might help solving any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-user-input
Projects
None yet
Development

No branches or pull requests

4 participants