OpenSSH:git@github.com 权限被拒绝

     2023-03-23     180

关键词:

【中文标题】OpenSSH:git@github.com 权限被拒绝【英文标题】:OpenSSH: git@github.com permission denied 【发布时间】:2020-01-07 19:46:40 【问题描述】:

我的一个项目需要使用 PowerShell 而不是 WSL。我想将我的终端设置为使用 ssh 而不是每次都输入我的凭据。

我过去曾在 WSL 上成功完成此操作,但似乎 OpenSSH 在 PowerShell 上给我带来了麻烦。当我尝试对一个全新的 repo 执行简单的推送命令时,我收到以下错误:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这就是事情开始变得奇怪的地方...我已经按照GitHub's article on this very subject 中列出的所有步骤进行操作,一切都表明我可以开始了。

这是我所做的:

    检查以确保 ssh-agent 正在运行。是的。

    ssh -vT git@github.com。它使用端口 22,最后我得到Hi [MyUsername]! You've successfully authenticated, but GitHub does not provide shell access.

    已验证 ssh-add -l -E md5 确实拥有正确的公钥。

    验证上面ssh-add 吐出的公钥与我添加到我的 GitHub 帐户中的公钥完全相同。

    尽管执行了第 1 步,但仍检查以确保确实找到了我的密钥。确实是(第二行):

...
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\aleks/.ssh/known_hosts:1
...

老实说,我很困惑,没有想法。怎么回事?

【问题讨论】:

【参考方案1】:

尝试将set GIT_SSH_COMMAND 转换为ssh -v,然后再次尝试您的git push。 或through a config

git -c core.sshCommand="ssh -v" push

输出将允许您检查 Git 是否正在查看正确的键。 确保您的 ssh-agent is started 在您的 Powershell 会话中

OP AlexH 确认in the comments:

第一次没有使用正确的身份。 我认为这与我将文件命名为 id_rsaid_rsa.pub 以外的名称有关。 重命名它们允许它通过。

【讨论】:

啊哈,好吧,第一次没有使用正确的身份。我认为这与我将文件命名为 id_rsaid_rsa.pub 以外的名称有关。重命名它们允许它通过。干杯。 @AlexH 太棒了!我已将您的评论包含在答案中以提高知名度。

github克隆项目的时候报错:git@github.com:permissiondenied(publickey).解决方法

问题Github克隆项目的时候报如下错:git@github.com:Permissiondenied(publickey).fatal:Couldnotreadfromremoterepository.Pleasemakesureyouhavethecorrectaccessrightsandtherepositoryexists.从上面报出的错误提示可以知道在克隆项目时没有权限所以被拒绝了,Github服... 查看详情

git@github.com:permissiondenied(publickey).////remote:permissiontoxxx/test.gitdeniedtoxxx.等(代码片段)

Errormsg[email protected]:Permissiondenied(publickey)或者:remote:Permissiontoxxx/test.gitdeniedtoxxx.等由于权限切换问题错误原因:  账号切换,原账号保存数据未清除解决:  1.清除凭证:控制面板-->用户账户-->凭证管理器-->管理凭证: ... 查看详情

ssh授权成功连接git@github.com后git命令授权失败

】ssh授权成功连接git@github.com后git命令授权失败【英文标题】:gitcommandsfailtoauthorizeaftersshauthorizationsucceedtoconnecttogit@github.com【发布时间】:2021-03-2307:19:27【问题描述】:我在github上创建了一个私有gitrepo。我运行命令ssh-keygen-ted255... 查看详情

Windows 上的 Git 克隆:git@github.com 不是 git 命令

】Windows上的Git克隆:git@github.com不是git命令【英文标题】:Gitcloneonwindows:git@github.comisnotagitcommand【发布时间】:2021-03-1115:23:52【问题描述】:我正在尝试通过ssh方式从github和另一种形式的gitlab克隆存储库我在Windows上编辑:使用Gi... 查看详情

我不能做 git push:git@github.com: Permission denied (publickey)

】我不能做gitpush:git@github.com:Permissiondenied(publickey)【英文标题】:Ican\'tdogitpush:git@github.com:Permissiondenied(publickey)【发布时间】:2021-09-2308:37:57【问题描述】:我无法在特定项目中执行gitpush命令,但是,在其他项目中一切顺利,... 查看详情

无法 SSH -T git@github.com

】无法SSH-Tgit@github.com【英文标题】:CannotSSH-Tgit@github.com【发布时间】:2021-04-2611:34:57【问题描述】:我一直在尝试在我的PC(Ubuntu20.04)上使用SSH(gitclone)连接GitHub。0.InstalledSSH,git1.CreatedSSH-keyunder~/.SSH/2.Submitmyid_rsa.pubkeytoGitHub3.SSH-Tg 查看详情

github配置了公钥依旧提示git@github.com‘spassword:permissiondenied,pleasetryagain.的解决办法(代码片段)

最近在给新电脑配置GitHub的ssh时,一切都是按照流程进行github上文档的配置流程进行配置,但是把公钥配置到github后,在对仓库进行操作的时候依旧出现一下提示git@github.com'spassword:Permissiondenied,pleasetryagain.但是... 查看详情

github配置了公钥依旧提示git@github.com‘spassword:permissiondenied,pleasetryagain.的解决办法(代码片段)

最近在给新电脑配置GitHub的ssh时,一切都是按照流程进行github上文档的配置流程进行配置,但是把公钥配置到github后,在对仓库进行操作的时候依旧出现一下提示git@github.com'spassword:Permissiondenied,pleasetryagain.但是... 查看详情

git+ssh 在像 git+ssh://git@github.com/xxx.git 这样的 npm repo 路径中是啥意思

】git+ssh在像git+ssh://git@github.com/xxx.git这样的npmrepo路径中是啥意思【英文标题】:Whatdoesgit+sshmeaninannpmrepopathlikegit+ssh://git@github.com/xxx.gitgit+ssh在像git+ssh://git@github.com/xxx.git这样的npmrepo路径中是什么意思【发布时间】:2020-03-1817:22:02 查看详情

git报错failedtopushsomerefsto'git@github.com:markprint/github.git'(代码片段)

 这个不知名小错误用了我两天的空余时间mmp  就是这里报的错输入gitpushoriginmaster-f解释为:   远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到的问题,可以先fetch再merge,也就是pull,... 查看详情

(已解决)npmerr!commandfailednpmerr!commandgitls-remotessh://git@github.com/nhn/raphael.git

这个错必须要记录一下了,看了网上很多的解决方法,最后终于找到原因了,npmERR!code128npmERR!commandfailednpmERR!commandgitls-remotessh://git@github.com/nhn/raphael.gitnpmERR!git@github.com:Permissiondenied(publickey).npmERR!fatal:Couldno 查看详情

git_错误_01_failedtopushsomerefsto'git@github.com

在使用git对源代码进行push到gitHub时可能会出错,信息如下此时很多人会尝试下面的命令把当前分支代码上传到master分支上。$gitpush-uoriginmaster但依然没能解决问题出现错误的主要原因是github中的README.md文件不在本地代码目录中可... 查看详情

解决gitpush报错:failedtopushsomerefsto‘git@github.com:anightmonarch/javaeasygoing.git‘(代码片段)

1、报错日志在向github远程仓库推送本地代码时,出现以下报错:error:failedtopushsomerefsto'git@github.com:anightmonarch/JavaEasyGoing.git'2、分析解决经查阅资料了解到出现这个错误的原因是因为远程仓库和本地仓库不一致导... 查看详情

解决gitpush报错:failedtopushsomerefsto‘git@github.com:anightmonarch/javaeasygoing.git‘(代码片段)

1、报错日志在向github远程仓库推送本地代码时,出现以下报错:error:failedtopushsomerefsto'git@github.com:anightmonarch/JavaEasyGoing.git'2、分析解决经查阅资料了解到出现这个错误的原因是因为远程仓库和本地仓库不一致导... 查看详情

gitpush报错error:failedtopushsomerefsto'git@github.com:

$gitpush-uoriginmasterTo[email protected]:xxx/xxx.git![rejected]master->master(fetchfirst)error:failedtopushsomerefsto‘[email protected]:xxx/xxx.git‘hint:Updateswererejectedbecausetheremo 查看详情

openssh windows 错误的所有者或权限

】opensshwindows错误的所有者或权限【英文标题】:opensshwindowsbadownerorpermissions【发布时间】:2018-09-3006:29:36【问题描述】:我已经为windows安装了openssh,当我运行sshlocalhost时,我得到了C:\\Users\\gary/.ssh/config上的所有者或权限不正确... 查看详情

$ssh-t-vgit@github.com_在本地用ssh连接github出错_git@github.com:permissiondenied(publickey).(代码片段)

$ssh-T-vgit@github.com报错:debug1:Authenticationsthatcancontinue:publickeydebug1:Nextauthenticationmethod:publickeydebug1:Tryingprivatekey:/Users/eveline/.ssh/id_rsadebug1:Tryingprivatekey:/Users/eveline/.ssh/id_dsadebug1:Tryingprivatekey:/Users/eveline/.ssh/id_ecdsadebug1:Tryingprivatekey:/User... 查看详情

如何在本地环境配置github

1、首先看你自己时候有账号,没有账号的话到https://github.com/注册Git账号。2、如果已有Git账号,则需要下载windows安装文件包,地址:http://git-scm.com/download3、有了安装包文件后直接双击安装即可(因为下载的是在线安装包,所以... 查看详情