作成: 更新:

WSLではじめてgitつかうとダメだった

この記事は最終更新日から1年以上が経過しています。この記事は最終更新日から21か月以上が経過しています。
このエントリーは約3分で読めます。

事象

$ git init
$ git remote add origin git@github.com:punkrou404/test.git
$ git fetch
"The authenticity of host '[ssh.github.com]:443 ([XX:XXXX::XXXX:XXXX]:443)' can't be established.\n" +
RSA key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no)? yes

"Warning: Permanently added '[ssh.github.com]:443' (RSA) to the list of known hosts.\n" +
setsockopt IPV6_TCLASS 32: Operation not permitted:
$ 

環境

windowsのwsl

$ cat /etc/*release
"NAME='openSUSE Leap'\n" +
"VERSION='15.1 '\n" +
"ID='opensuse-leap'\n" +
"ID_LIKE='suse opensuse'\n" +
"VERSION_ID='15.1'\n" +
"PRETTY_NAME='openSUSE Leap 15.1'\n" +
"ANSI_COLOR='0;32'\n" +
"CPE_NAME='cpe:/o:opensuse:leap:15.1'\n" +
"BUG_REPORT_URL='https://bugs.opensuse.org'\n" +
"HOME_URL='https://www.opensuse.org/'\n" +
$

検証結果

IPv6のせいだったのか...?
IPv4だけsshdが受け付けるようにしてdone
あとgit config足りなかったみたい

$ cat ~/.ssh/config
Host github.com 
        HostName ssh.github.com
        Port 443
"$ sed -i '1iAddressFamily inet' ~/.ssh/config\n" +
$ git fetch
"Warning: Permanently added the RSA host key for IP address '[00.000.000.000]:443' to the list of known hosts.\n" +
$
"$ git config --global user.email 'punkrou404@gmail.com'\n" +
"$ git config --global user.name 'punkrou404'\n" +
$ git fetch
$

参考