LoginSignup
1
0

More than 3 years have passed since last update.

wslでgh auth loginできない時の対処

Posted at

wslからgh auth login したときにうまくいかない時の対処。
以下のようメッセージが出て認証したいのにブラウザが立ち上がらない時がある。

 # gh auth login                                                                                                                          [11:24:22]
? What account do you want to log into? GitHub.com
- Logging into github.com
? How would you like to authenticate? Login with a web browser

! First copy your one-time code: 637D-7161
- Press Enter to open github.com in your browser...
failed to authenticate via web browser: exec: "/mnt/c/Program": stat /mnt/c/Program: no such file or directory

$BROWSER中身を確認すると以下。

 # echo $BROWSER                                                                                                                          
/mnt/c/Program Files/Google/Chrome/Application/chrome.exe

"Program Files"に含まれる空白のせいでパスをうまく読み取れない問題とわかるので、$BROWSERを引用符付きに変更してあげる。
私の場合は.zshrcで以下のように変更。

export BROWSER='"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"'

再度authを試すと無事ブラウザが立ち上がり認証を通すことができました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0