作成: 更新:

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

WindowsGit

事象

$ 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.
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.
setsockopt IPV6_TCLASS 32: Operation not permitted:
$ 

環境

windowsのwsl

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

検証結果

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

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

参考