0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WSL の git

Last updated at Posted at 2021-07-19

Ubuntu 20.04LTS
WSLでも基本変わらないはず。
keyはwindowsホスト側に存在するので、これを一緒に使いたい。

接続できないことを確認。

ssh -T git@github.com
The authenticity of host 'github.com (52.192.72.89)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

これはgithubのホストの確認なので、ここと一致していたら yes を押す。

yes
Warning: Permanently added 'github.com,52.69.186.44' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).

何も設定していないのでアクセスはできない。
keuの設定をする。

~/.ssh/configで設定。
windows は /mnt/c/以下にマウントされているので、共通して使える。

$ more config
Host github.com
     User KojiKobayashi
     IdentityFile /mnt/c/Users/k.kobayashi/(ppkへのパス)

User は登録emailでもいいみたい。
もう一回確認。

$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '52.192.72.89' to the list of known hosts.
Enter passphrase for key '/mnt/c/Users/k.kobayashi/(ppkへのパス)':
Hi KojiKobayashi! You've successfully authenticated, but GitHub does not provide shell access.

追記
いつのまにか key が使えなくなった

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/mnt/c/Users/キーのパス' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/mnt/c/Users/キーのパス": bad permissions
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

しょうがないのでキーをlinux側にコピーしてpermission変更(600)

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?