Skip to content

GitHub CLIがudp53でread: connection refusedになる

GitHub CLIが動かなくなっていた。調査のため、環境変数にDEBUG=1をセットして実行した。

Terminal window
$ DEBUG=1 gh auth login -w -p https
[git config credential.https://github.com.helper]
[git config credential.helper]
? Authenticate Git with your GitHub credentials? No
* Request at 2022-03-02 17:01:22.367551107 +0900 JST m=+1.017459246
* Request to https://github.com/login/device/code
* dial tcp: lookup github.com on [::1]:53: read udp [::1]:50126->[::1]:53: read: connection refused
* Request took 1.328532ms
error connecting to github.com
lookup github.com on [::1]:53: read udp [::1]:50126->[::1]:53: read: connection refused
check your internet connection or https://githubstatus.com

何が起こっているのか詳細は追っていないが、/etc/resolve.confが空の場合は、以下を追加すると動くかもしれない。

nameserver 8.8.8.8

または、systemd-resolvedではstub-resolv.confを参照するを設定しておくと解決するかもしれない。