LoginSignup
1
5

More than 5 years have passed since last update.

GitHubの公開キー使ってSSHログインできるようにしてみた.

Posted at

GitHubには公開キーを複数登録しているので、
それをそのままSSHのログインに利用してみた.

ssh-copy-idはリモートホストにコピーしてくれるけど、
ssh-copy-id-githubはリモート(GitHub)からローカルの~/.ssh/authorized_keysに追記します.

使い方はこんな感じ.

curl -o ssh-copy-id-github https://git.io/ssh-copy-id-github
chmod +x ssh-copy-id-github
ssh-copy-id-github octcat

ssh-copy-id-github ${GITHUB_USER}を実行するだけ.

ソースはGistに上がってます.

cronとか使って定期的に同期しておけばPC買い換えてもGithubに公開キーを登録するだけ.

1
5
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
1
5