【Github】 1台のリポジトリで、複数のGithubアカウントにSSH接続

本日のエラー内容

[1] Githubページでは
Add SSH keyを押すと、

Key is already in use
[2]
$ git push -u origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

トラブルシューティング

参考資料 https://help.github.com/en/github/authenticating-to-github/error-key-already-in-use

実行結果

Hi [1つ目のGithubアカウント名]! You've successfully authenticated, but GitHub does not provide shell access.

参考資料

https://qiita.com/yampy/items/24638156abd383e08758

Host github.com.sub # サブアカウント
  HostName github.com
  User git
  Port 22
  IdentityFile ~/.ssh/private_account  # サブアカウント用の鍵
  TCPKeepAlive yes
  IdentitiesOnly yes

接続テスト

ssh -T git@github.com.sub

Hi [2つ目のGithubアカウント名]! You've successfully authenticated, but GitHub does not provide shell access.

.git/configも変更

$ git remote -v
[変更前] git@github.com:[githubアカウント名]/[リポジトリ名]
[変更後] git@github.com.sub:[githubアカウント名]/[リポジトリ名]
プロジェクトの.git内にあるconfig
<変更前>

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
<変更後>

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[user]
        name = [githubのアカウント名]
        email = [github登録のEmail]
[remote "origin"]
        url = git@github.com.sub:[githubのアカウント名]/[リポジトリ名].git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master