Permission to one repository denied to another(unwanted) git account

My personal solution to solve this problem is:

1. Check the credentials

ssh -T

The name printed out should be your wanted user name.

If not, go step 2.

2. Connect ssh.

cd ~/.ssh

3. Connect to wanted ssh

ssh-add ~/.ssh/id_rsa_account1

4. Check the connected ssh list

ssh-add -l

If there shows your wanted ssh. Then problem should be solved.