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?

githubのSSH登録

何度やっても、PC買い替えるたびに忘れるので、忘備録として残します。

githubのSSH鍵の登録手順(Windows)

①SSH-keygenをPowerShell 7で~/.sshディレクトリで実行

ssh-keygen -t ed25519

※初回は、SSH-agentいらないけど、鍵が増えるにつれてWindowsの場合、いるっぽい。
.pubのほうをgithubに登録
登録方法は、右上自分のアイコン→settings→SSH & GPG Keys
image.png

管理者権限でPosh7を立ち上げる。

②SSH-Agentの状態確認

 Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

# こちらが出るといい
Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

ClientがInstalledになっていないとダメ。

Get-Service ssh-agent | Format-List *

UserName            : LocalSystem
Description         : Agent to hold private keys used for public key authentication.
DelayedAutoStart    : False
BinaryPathName      : C:\windows\System32\OpenSSH\ssh-agent.exe
StartupType         : Disabled
Name                : ssh-agent
RequiredServices    : {}
CanPauseAndContinue : False
CanShutdown         : False
CanStop             : False
DisplayName         : OpenSSH Authentication Agent
DependentServices   : {}
MachineName         : .
ServiceName         : ssh-agent
ServicesDependedOn  : {}
StartType           : Disabled
ServiceHandle       : Microsoft.Win32.SafeHandles.SafeServiceHandle
Status              : Stopped
ServiceType         : Win32OwnProcess
Site                :
Container           :

statusがstoppedなら、動いてない。

# 開始
Set-Service ssh-agent -StartupType Manual
Start-Service ssh-agent

# 確認
Get-Service ssh-agent

# Runningになればいい。
Status    : Running
StartType: Manual

④鍵登録

ssh-add $env:USERPROFILE\.ssh\鍵名

⑤鍵の確認

ssh-add -l

⑥接続テスト

ssh -T git@github.com

これでHi, ~みたいなのが出たらOK

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?