I have two github accounts, which I'll call ActOne and ActTwo, with emails which I'll call em@one.net and em@two.net. I need to switch off between the two accounts, but I can't get the second account to work.
My current project uses the ActTwo account. When I say git push
, I get this error message:
remote: Permission to ActTwo/Tools.git denied to ActOne.
fatal: unable to access 'https://github.com/ActTwo/Tools.git/': The requested URL returned error: 403
I don't know why it's trying to use ActOne instead of ActTwo. My current project's .git/config file looks like this:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/ActTwo/Tools.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
email = em@two.net
name = ActTwo
[credential]
helper = osxkeychain
My ~/gitconfig file looks like this:
[color]
ui = auto
[filter "lfs"]
smudge = git-lfs smudge %f
required = true
clean = git-lfs clean %f
[credential]
helper = osxkeychain
It used to have this, but I removed it in a vain attempt to fix the problem:
[user]
email = em@one.net
name = ActOne
Addendum:
The problem seems to be because my credential helper (osxkeychain) has associated ActOne to the github URL. I added a second entry to Keychain Access for the other account, but it doesn't work. And the reason it doesn't work is that the "Access Control" tab doesn't have an entry for git-credential-osxkeychain. And I can't add one, because the actual application is inside my xCode application bundle, and there isn't any way that I can find in KeychainAccess to go inside an application bundle. Is this the right approach? Does anyone know how to do this?