I commit to Github for work and for personal use. For the last two months I have consistently had trouble each and every time I switch github contexts. Every night (and every morning) I run into error's pushing to or pulling form Github like this:
ERROR: Permission to AlexanderBollbach/test.git denied to alexbollbach.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
If I can get the pushing/pulling to work properly (usually through some circuitous path of reading StackOverflow posts about SSH/Github/Git and not understanding them in any depth), I immediately run into the same problems again when I switch from work Github to home or vice versa.
The only interesting clue I have noticed is that in denied to alexbollbach
, "alexbollbach" is my work Github account username. hmm, this leads me to consider ~/.ssh/config
, whose contents are:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host github.com
User git
Host helper
HostName <work-domain-stuff>
IdentityFile ~/.ssh/eng_rsa
User eng
I was told that this file is instrumental in configuring git's ssh attempts. But I still cannot make the connection between this file and the git push error thinking that I am alexbollbach
. In fact, I do not know how ssh, my key pairs, and the config file relate to the notion of Github user's in any sense.
Please help. Preferably not just a fix but some clarification on what i'm not grasping. I routinely spend an hour at least twice a week running into this issue.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…