Permission denied to git repo pushing

Sometimes we have an error like below when we try to push on Github.

Try to check where is your ssh key is being used by the following command:

 ssh -T -ai ~/.ssh/id_rsa [email protected]

You will get a response like this:

So, in my case, my ssh key was being used by my other GitHub account. Now you have 2 choices.

  1. Remove ssh key from other account and add to your account where you are trying to push
  2. Generate new ssh key and use it.

I did 1st as It was not needed for my other account.