我可以 ssh 连接 git@github.com,并返回成功窗口,但无法将任何内容推送到 github,服务器返回:
Permission denied (publickey).
fatal: Could not read from remote repository
我如何解决这个问题:
删除原点并重新添加:
git remote rm origin
git remote add origin git@github.com:<xxxx>/<xxxx>.git
git branch -M main
git push -u origin main
终端返回:
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'.