I have two github accounts and their user names are as so :
subhayan-bhattacharya
subhayan-test
Now i want to do work(push/pull) in both the repositories using the same machine. Hence i have set up two ssh keys for this . The default one points to subhayan-bhattacharya account.
total 48
drwx------ 8 subhayan.bhattachary 1796758494 256 Jul 20 23:46 .
drwxr-xr-x+ 38 subhayan.bhattachary 1796758494 1216 Jul 20 23:46 ..
-rw-r--r-- 1 subhayan.bhattachary 1796758494 50 Jul 20 23:31 config
-rw------- 1 subhayan.bhattachary 1796758494 3401 Jun 14 15:28 id_rsa
-rw-r--r-- 1 subhayan.bhattachary 1796758494 755 Jun 14 15:28 id_rsa.pub
-rw-r--r-- 1 subhayan.bhattachary 1796758494 990 Jul 5 13:36 known_hosts
-rw------- 1 subhayan.bhattachary 1796758494 1856 Jul 20 23:41 newkeys
-rw-r--r-- 1 subhayan.bhattachary 1796758494 421 Jul 20 23:41 newkeys.pub
I have added the relevant ssh keys to the ssh and gpg keys section of the respective git hub accounts.
My .ssh/config file looks like this:
7tvmb228:.ssh subhayan.bhattachary$ vi config
Host *
AddKeysToAgent yes
UseKeychain yes
The problem is i am not being able to push to the subhayan-test account . I tried like so :
7tvmb228:starter-web subhayan.bhattachary$ ssh-add ~/.ssh/newkeys
Identity added: /Users/subhayan.bhattachary/.ssh/newkeys (subhayan.bhattachary@7tvmb228.fritz.box)
7tvmb228:starter-web subhayan.bhattachary$ git push
ERROR: Permission to subhayan-test/starter-web.git denied to subhayan-bhattacharya.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
~
I dont know why it says that permission denied to subhayan-bhattacharya since this is the other git hub account name.
However the push and pull to the other account works normally.
What should i check and why this does not seem to work.