'Permission Denied for wrong user when I use "git push" [duplicate]

I was using git with my username and email and everything was working well. For one specific project I used different username and email to push some commits for another person. I set back git config user.name and git config user.email how they were but when I use git push it says "Permission to repo denied for "username of that person">". How can I solve this problem to make git use my username and email how they were.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source