LoginSignup
1
2

More than 3 years have passed since last update.

GitHubにSSHで接続する

Last updated at Posted at 2020-02-21

GitHubにSSHで接続する

何番煎じわからないけど、備忘録としてまとめる。

SSH keyの作成

cd ~/.ssh/
ssh-keygen -t rsa -b 4096 -C "your_email@gmail.com"
...
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [id_rsa_git]
Enter passphrase (empty for no passphrase): [Type a passphrase]
...

SSH keyをGithubに登録

右上のアイコン -> Settings -> SSH & GPG keys -> New SSH key

  • Title: 適当につける
  • Key: 作成したid_rsa_git.pubの中身をコピペ

ローカルの設定

SSH config

vim ~/.ssh/config
...
Host github.com
  User git
  Hostname github.com
  IdentityFile ~/.ssh/id_rsa_git
...

SSH agent

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa_git

接続確認

ssh github.com
...
Enter passphrase for key '/home/pi/.ssh/id_rsa_git': 
PTY allocation request failed on channel 0
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
...

終わり

ここまでやるとgit cloneできるはず

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