I have set up git successfully and pushed my project to remote repository.
I had already setup my global user.name and user.email by executing following:
git config --global user.name 'user1'
git config --global user.email 'user1@example.com'
Now I have another repository for which I needed a different user, so I created another user specific to that repo by executing :
git config user.name 'user2'
git config user.email 'user2@example.com'
And when it try to execute git push, it is not letting me push my code and says
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
It was letting me push my changes with global user, what is different now ? I am new to git and its hard for me to get along.
Edit: I have separate ssh keys for my github account and my bitbucket account. That is, I want to ssh to my github repo using global settings and to my bit bucket repo using repo specific settings.