I can ssh the connect git@github.com, and return the successful window, but cannot push anything to github, the server return that:
Permission denied (publickey).
fatal: Could not read from remote repository
how I solve the question:
delete the origin and re-add it:
git remote rm origin
git remote add origin git@github.com:<xxxx>/<xxxx>.git
git branch -M main
git push -u origin main
the terminal returns:
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 321 bytes | 321.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:ShowTimeWalker/MyFirstTrailForGit.git
* [new branch] main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.