LoginSignup
0
0

More than 5 years have passed since last update.

複数のgithubアカウントにssh keyを登録する

Posted at

キーを作成する

github_private_rsaはお好きなファイル名でどうぞ

ssh-keygen -t rsa -C "your_email@example.com" -f github_private_rsa

sshキーをコピーして2つ目のgithubに登録する

cat ~/.ssh/github_private_rsa.pub | pbcopy

.ssh/configに設定を追加

.ssh/config

Host github-private.com
  User git
  HostName github.com
  IdentityFile ~/.ssh/github_private_rsa
  TCPKeepAlive yes
  IdentitiesOnly yes

実際にcloneする時に気をつけること

git@github.com:user_name/repository_name.git
となっているものを.ssh/config で使っているHostに置き換える必要がある

- git@github.com:user_name/repository_name.git
+ git@github-private.com:user_name/repository_name.git
git clone git@github-private.com:user_name/repository_name.git
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