LoginSignup
1
2

More than 5 years have passed since last update.

GitHubにSSHで接続する

Last updated at Posted at 2019-02-22

SSHのキーを作る。

ssh-keygen -t rsa

https://github.com/settings/ssh で公開鍵をGitHubにアップロードする。

ssh -T git@github.com

で接続できるかを確かめる。~/.ssh/config に設定を書く:

Host github github.com
  HostName github.com
  User git
  IdentityFile "/Users/a/.ssh/id_rsa"

~/.gitconfig に以下の設定を追加する。

[url "github:"]
    InsteadOf = https://github.com/
    InsteadOf = git@github.com:

もしくは以下をリポジトリのディレクトリ内で行う。

git remote set-url origin git@github.com:[ユーザ名]/[リポジトリ名].git
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