Git SSH 问题 : Terminal works fine, 但所有 GUI 客户端都失败

标签 git github ssh-keys permission-denied public-key

因此,我在使用 git 和 Github 时遇到了这个问题,当我使用终端时,事情按预期工作,但是从 Git GUI 客户端(如 GitHub 桌面应用程序、SourceTree、Fork 等)中执行任何操作都会给我权限被拒绝(公钥)问题。

甚至尝试像 ssh -T git@github.com 这样的命令在终端中,按预期工作。这是 Fork 中我的 Github 帐户设置的屏幕截图:如您所见,看起来甚至我的 SSH key 都已正确配置并且似乎已被识别。我想避免生成新的 SSH key 并在 GitHub 中设置它的过程,除非实际上没有其他选择。

enter image description here

最佳答案

Even trying out commands like ssh -T git@github.com in the terminal, works as expected.



在这些 GUI 客户端中仔细检查用于远程存储库的 SSH URL。

应该是 git@github.com:<me>/<myrepo> .

如,如我 mentioned here ,在启动 GitHub Desktop 之前先尝试:
git config --global core.sshCommand "'C:\Windows\System32\OpenSSH\ssh.exe'"

(假设这里是 Windows 10)

对于 Mac,请遵循“How to Manage Multiple SSH Keys”并确保您的 key 已添加到 ssh-agent:
ssh-add -K ~/.ssh/_id_rsa

~/.ssh/config
Host *
  AddKeysToAgent yes
  UseKeychain yes

SSH will look for key in keychain and if it finds it you will not be prompted for password.
Key will also be added to ssh-agent. On MacOS this will work on MacOS Sierra 10.12.2 or later.

关于Git SSH 问题 : Terminal works fine, 但所有 GUI 客户端都失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62090300/

相关文章:

git - 在开发服务器上测试/预览 Github 分支

git cvsimport 失败 : Could not merge master into the current branch

git - Databricks 从存储库内的 python lib 导入/复制数据

Git 发布具有大量 NuGet 依赖项的 Azure 网站

github - 如何重新发布之前从 github 删除的存储库?

git - 源树: Not able to push to my remote repo in GitHub

git - 特 pull 维斯 CI : Avoiding repeated installation of packages for each commit

macos - 使用 ssh-keygen 创建 JSch 接受的 SSH 私钥

git - 无法在 github 中提交 : not able to connect port 443

linux - 期待脚本 - 自动密码