githubで複数のリポジトリを管理するときにはまったこと
はまったこと
% git remote show jkc ERROR: Permission to voidy21/JavaKusoCode denied to voidy21/dotfiles. fatal: The remote end hung up unexpectedly
とか言われて何もpushとかさせてもらえない状態になった
結論から言うと
それぞれのリポジトリのDeploy KeysとAccountのPublic Keysは同じものを使ってはいけない!
逆に言えば、アカウントを持っている張本人の場合、Public Keyさえ登録すればDeploy Keyは登録する必要が無いということです!
以下個人用メモ(Ubuntuでgithubを使う場合)
ssh公開鍵を作る
% cd ~ % ssh-keygen
~/.ssh/id_rsa.pubをコピーしてhttps://github.com/accountのSSH Public Keysから追加登録
remoteリポジトリを登録
% cd (作業用ディレクトリ) % git remote add (名前) (URL)
例) git remote add github git@github.com:voidy21/dotfiles.git
ここではgithubというリモートリポジトリを登録した
ローカルな環境にコミットとかする
% git init
% git add .
% git commit -m 'first commit'
githubにpush!!!
% git push github master
先ほど作ったリモートリポジトリgithubを使う