I am in VS code as a particular git user (say user1) and want to pull & commit changes from one of my other github accounts (user2). After pulling my repository & commiting when I push I get the error of type:
remote: Permission to user2/repository.git denied to user1.
fatal: unable to access 'https://github.com/user2/repository.git/': The requested URL returned error: 403
So I assume this error is simply because I am 'logged in' as user1 in VS code. But how exactly can I change myself to user2 to be able to work on this repository?
I am using Macbook. I have tried many variety of ways e.g. changing to SSH cloning & resetting git config without any luck. There has to be a very simple solution to this problem which should be very basic. I was expecting it will ask me for credentials for the second account but it never did.