Handling multiple git accounts with different credentials
As mentioned in the credentials documentation
By default, Git does not consider the “path” component of an http URL to be worth matching via external helpers. This means that a credential stored for https://example.com/foo.git will also be used for https://example.com/bar.git.
Setting the useHttpPath configuration option to true will change the default behavoir
git config --global credential.useHttpPath true
You will be prompted for passwords for existing repositories after this change