首页 > 解决方案 > 如何在 Windows 上仔细检查我的 SSH 凭据?

问题描述

我是我公司组织的成员。与我的帐户关联的 SSH 密钥。没有按预期工作。我正在尝试推动我的分支

$ git push -u origin mirispc
The authenticity of host 'github.com (140.82.121.4)' can't be established.
RSA key fingerprint is SHA256:$$$$$$$$$$$$$$$$$.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

我克隆了我的 comp 私人仓库(出于安全原因更改了详细信息)

origin  git@github.com:mycomp/repo-pr (fetch)
origin  git@github.com:mycomp/repo-pr (push)

ssh -Tv git@github.com由于篇幅原因,我将只复制部分内容

    OpenSSH_8.5p1, OpenSSL 1.1.1k  25 Mar 2021
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Connecting to github.com [140.82.121.3] port 22.
    debug1: Connection established.
    debug1: identity file /c/Users/jholmes/.ssh/id_rsa type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_rsa-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_dsa type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_dsa-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ecdsa type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ecdsa-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ecdsa_sk type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ecdsa_sk-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ed25519 type 3
    debug1: identity file /c/Users/jholmes/.ssh/id_ed25519-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ed25519_sk type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_ed25519_sk-cert type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_xmss type -1
    debug1: identity file /c/Users/jholmes/.ssh/id_xmss-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_8.5
    debug1: Remote protocol version 2.0, remote software version babeld-22beb20a
    debug1: compat_banner: no match: babeld-22beb20a
    debug1: Authenticating to github.com:22 as 'git'
    debug1: load_hostkeys: fopen /c/Users/jholmes/.ssh/known_hosts2: No such file or directory
    debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
    debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received

And 
debug1: load_hostkeys: fopen /c/Users/jholmes/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/jholmes/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
....
Hi JHolmes! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1

我从 Git Bash 运行所有这些。

我现在应该尝试什么?

标签: gitgithubssh

解决方案


首先,确保https://github.com/mycomp/repo-pr确实存在(意味着 URL 的大小写正确)

其次,检查你是否通过 SSH 被 GitHub 正确认证:

ssh -Tv git@github.com

第三,与您的组织管理员再次确认您确实是该组织的成员。

在 Windows 上,确保您没有设置 GIT_SSH 环境变量。


推荐阅读