首页 > 解决方案 > 尽管有效的 SSH 身份验证,但 Git 的权限被拒绝

问题描述

今天早上我的 Windows git 客户端让我惊讶

> git pull

git@github.xxx.net: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

尽管使用 GitHub 的 SSH 身份验证有效,但仍会发生这种情况

>ssh git@github.xxx.net
PTY allocation request failed on channel 0
Hi dzieciou! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.xxx.net closed.

可能是原因吗?我拥有访问这个特定项目的所有必要权限。

标签: windowsgitssh

解决方案


首先,检查输入git pull后相同的内容

set GIT_SSH_COMMAND="ssh -Tv"

并将其与ssh -Tv git@github.xxx.net

其次,确保没有其他GIT环境变量。列出它们:

set GIT

这是为了检查是否存在GIT_SSH环境变量,引用不同的 ssh 作为默认情况下与 Git for Windows 一起使用的 ssh。


推荐阅读