繁体   English   中英

GitHub 尽管已登录,但仍出现多密钥身份验证错误?

[英]GitHub multiple keys authentication error despite being logged in?

我在我的 Mac 上设置了多个 GitHub 帐户。 它曾经很好用,直到最近它才停止工作,我不知道为什么。 我的帐户有我的计算机 ssh 密钥,ssh 配置是正确的,我什至登录并验证了通过gh auth不起作用的帐户。

配置文件

# ~/.ssh/config
# ...
Host github.com-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_work

回购

检查git config

$ git config --list
credential.helper=osxkeychain
user.email=work-username@work.com
...
remote.origin.url=git@github.com-work:work-username/work-repo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
...

检查gh auth

$ gh auth status
github.com
  ✓ Logged in to github.com as work-username (/Users/work-username/.config/gh/hosts.yml)
  ✓ Git operations for github.com configured to use ssh protocol.
  ✓ Token: *******************

试着拉

$ git pull
ERROR: Repository not found.
fatal: Could not read from remote repository.

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

注意:

$ ssh -T -i ~/.ssh/id_rsa_work git@github.com
Hi not-work-username! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh -T -i ~/.ssh/id_rsa_work git@github.com-work
Hi not-work-username! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh -T git@github.com
Hi not-work-username! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh -T git@github.com-work
Hi not-work-username! You've successfully authenticated, but GitHub does not provide shell access.

我做错了什么以及如何让它再次工作?

检查id_rsa_work.pub的内容并获取其指纹

查看指纹是否在预期账户的SSH设置页面(或“非预期”账户)

将其内容与gh ssh-key list进行比较。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM