当我在 Windows 10 v.1909上使用CMD和PowerShell和 ssh-agent从 GitHub 克隆时,显示如下:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)
但是,我跑ssh -vT git@github.com了,钥匙确实有效
debug1: Offering public key: {My key}
Run Code Online (Sandbox Code Playgroud)
和
Hi {My username}! You've successfully authenticated, but GitHub does not provide shell access.
Run Code Online (Sandbox Code Playgroud)
但是使用 Git bash 我可以很好地克隆。
GitLab 也会发生这种情况。
我试过
Host *
ForwardAgent yes
Run Code Online (Sandbox Code Playgroud)
在.ssh/config,它不起作用。
我还尝试了GitHub 支持页面和GitHub 社区论坛的所有解决方案,但仍然无效。
附注。我更喜欢 Windows cmd。