I am able to do Git clone of repo without any error. But, when I try to push any branch upstream on GitHub, I get the following error:
(base) guoling@Guo-MacBook-Pro test % git push --set-upstream origin test-branch
ERROR: Permission to guoling9419/test.git denied to myGitHubUsername.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
How can I resolve the above issue?
Here myGitHubUsername
is my GitHub username.
I have set up ssh public private key pair on my laptop. And, have already added my ssh public key (id_rsa.pub
) to GitHub page.
I am using macOS Monterey version 12.4.
I accidentally overwrote my ~/.ssh/config
file. I have tried to remedy it by doing the following to ~/.ssh/config
:
Host agent1
User root
HostName 198.199.92.88
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
I am following this dedicated GitHub page and this Stackoverflow post to debug.
When I do ssh -T git@github.com
, I get the output Hi myGitHubUsername! You've successfully authenticated, but GitHub does not provide shell access.
When I do ssh github
, I get the output ssh: Could not resolve hostname github: nodename nor servname provided, or not known
When I do eval "$(ssh-agent -s)"
, I get the output Agent pid 50031
.
When I do ssh-add -l -E sha256
, I get the output The agent has no identities.
When I do ssh-add -l -E md5
, I get the output The agent has no identities.