LoginSignup
5
4

More than 3 years have passed since last update.

githubアカウントを統合した時のメモ

Last updated at Posted at 2019-07-06

背景

アカウントを切り替えるのが面倒なので、会社と個人のアカウントを統合した。
(会社的にok)

step1. メールアドレスの整理

githubでは同じメールアドレスを使えないようです。
重複して登録しようとすると怒られるので、整理します。

https://github.com/settings/emails
消し去る予定の個人githubのメールアドレスを使いたかったので、個人アカウントの方に別のアドレスをまず登録し、そちらをprimaryに設定してから使い続けたいメールアドレスを削除する。

その後、統合アカウント(元会社アカウント)に先ほど空けたメールアドレスを登録し、primaryに設定する。
もともとあった会社メールアドレスはbackupに変える。
backupに変えてもnotidficationは受け取り続けると記載があるので大丈夫そう。(メールのnotificationは見ないからどっちでもいいけど)

step2. gitconfig設定変更

$ git config --global user.name "統合アカウント"
$ git config --global user.email "統合アカウントメールアドレス"

step3. 統合アカウントに個人macのsshの設定も追加する

まだpublic keyを発行してない人は発行してから

$ cd ~/.ssh # まだ鍵を発行してない人のみ
$ ssh-keygen -t rsa # まだ鍵を発行してない人のみ
$ cat ~/.ssh/id_rsa.pub | pbcopy

https://github.com/settings/ssh/new
ここに登録する。
一応確認。Successのメッセージが出ればOK。

$ ssh -T git@github.com

step4. おまけ

ここでgit pushしたらエラーがでた。

remote: Permission to xxxxx denied to [旧個人github].

記憶にないですが、macのkeychainに設定していたらしい。

$ git config credential.helper
osxkeychain

macのApplication > Utilities > Keychain Access を開き、
検索窓でgitで検索してgithub.comで登録された秘密鍵を削除したら成功。
一応古いアカウントのssh keyも消した。

参考

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