My global user overrides my local git user.
Here's the full context: I have 2 Github accounts, so I wanted to set my ssh keys for those repos.
I've tried all of those guides.
Here's my ~/.ssh/config
# Personal GitHub
Host github.com
HostName github.com
User mirkancal
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
# Yazılım Kafe
Host github.com-yazilimkafe
HostName github.com
User yazilimkafe
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_yazilimkafe
IdentitiesOnly yes
My git remote -v
output for the repo of yazilimkafe
origin git@github.com-yazilimkafe:yazilimkafe/git-dersi.git (fetch)
origin git@github.com-yazilimkafe:yazilimkafe/git-dersi.git (push)
I've added local usernames and emails accordingly. Related SO post 1 SO post 2
Here's my local gitconfig
[user]
name = yazilimkafe
email = mirkancaliskan.dev@gmail.com
So I believe I'm all set but when I try to use git push origin master
It gives me that:
ERROR: Permission to yazilimkafe/git-dersi.git denied to mirkancal.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I think on the ssh side, I don't have a problem, but I can't prevent my global user to not the override my local user in the repo. My question is, how to do that? Am I doing something wrong on the ssh part?