【问题标题】:How to doublecheck my SSH credentials on WIndows?如何在 Windows 上仔细检查我的 SSH 凭据?
【发布时间】:2021-08-30 14:51:17
【问题描述】:

我是我公司组织的成员。与我的帐户关联的 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 运行所有这些。

我现在应该尝试什么?

【问题讨论】:

  • 你的情况的根本原因是什么(来自我在回答中提到的那些)?
  • @VonC 可以看看吗?GitHub不提供shell访问,怎么来的?
  • 这是意料之中的:对于像 GitHub 这样的远程 Git 托管服务,永远不会使用 ssh 直接交互式 shell 访问。这只是一种确保您被 GitHub 识别/身份验证的方法,这里就是这种情况。

标签: git github ssh


【解决方案1】:

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

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

ssh -Tv git@github.com

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-28
    • 1970-01-01
    相关资源
    最近更新 更多