For macOS users :
This error appears when you are using multiple Git accounts on the same machine.
Please follow below steps to remove the github.com credentials.
- Go to Finder
- Go to Applications
- Go to Utilities Folder
- Open Keychain Access
Select the github.com and Right click on it
Delete "github.com"
Try again to Push or Pull to git and it will ask for the credentials. Enter valid credentials for repository account. Done