Multiple git account – SSH connect PUSH/Pull ERROR: Repository not found Problem Fixing
Whenever you will use multiple github account repo with SSH Connect then normanlly you will git error like this.
~/projects/demo2$ git push --set-upstream origin main
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
Now we will solve this problem
1-First you will add new Host to System ssh folder. Please see Bold part
BOOK-VKAD2MI9OH:~$ cd ~/.ssh
BOOK-VKAD2MI9OH:~/.ssh$ nano config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/mac_rsa
IdentitiesOnly yes
AddKeysToAgent yes
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/mac_rsa
IdentitiesOnly yes
AddKeysToAgent yes
Host github-demo
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github_demo
IdentitiesOnly yes
AddKeysToAgent yes
2- Then We will change Remote url
BOOK-VKAD2MI9OH:~/projects/demo2$ git remote set-url origin git@github-demo:repo-user/demo2.git
Please note above we are using git@github-demo not git@github.com because github.com already working for other account repo.