【问题标题】:GitHub push Error occurs. (ssh key doesn't work)出现 GitHub 推送错误。 (ssh 密钥不起作用)
【发布时间】:2022-01-28 00:06:23
【问题描述】:

问题描述: 当我尝试推送到 GitHub Pages 时出现错误。

ERROR: Permission to lut/EvolutionApp.git denied to ~.
fatal: Could not read from remote repository.

我已经搜索了 3 天,并且尝试了所有解决方案,但它根本不起作用。我不知道从什么时候开始,我已经将分支 master 更改为 main(远程和本地)。
我不确定这是主要问题。
我已经尝试过

  1. 我生成了 ssh key 并将其添加到 GitHub 设置中。
    当我写>ssh -T git@github.com 它显示Hi DanielFH1! You've successfully authenticated, but GitHub does not provide shell access.

状态
1.

# I've changed default branch master to main
>git status 
on branch main
>git remote
origin
# I've deleted branch master and leave only default branch 'main'
>git branch -d master
Deleted branch master (was 6eca8640).
>git branch
* main

Full Error:错误主要是cannot push(1) or pull(2)
1.

>git push origin main
ERROR: Permission to lut/EvolutionApp.git denied to ~.
fatal: Could not read from remote repository.
>git pull origin main
fatal: couldn't find remote ref main
# It seems it connected to port 22 as github description says, and says 'successfully   
 authenticated' in the last line. Are these means OK?
>ssh -vT git@github.com
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to github.com [52.78.231.108] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\SeungWoo/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version babeld-17a926d7
debug1: no match: babeld-17a926d7
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\SeungWoo/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:isIh1SLbiAdxDs2LohVlLlC4mXm0bKEWPhMvuZLlpuQ C:\\Users\\SeungWoo/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 407
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([52.78.231.108]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi DanielFH1! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2944, received 2912 bytes, in 0.4 seconds

【问题讨论】:

  • 您的 ssh 密钥对属于用户“DanielFH1”,但您正试图推送到属于用户“lut”的存储库。您是否有权推送到用户的“lut”存储库?
  • 我更改了远程 repo url 并在页面设置中将分支设置为“主”。它有效。谢谢。

标签: git github github-pages


【解决方案1】:

本地分支与远程不同步。 Git reset --hard 是一种选择

【讨论】:

    猜你喜欢
    • 2014-05-14
    • 2018-03-17
    • 2019-05-21
    • 1970-01-01
    • 1970-01-01
    • 2018-02-27
    • 1970-01-01
    • 2021-06-07
    • 2023-03-16
    相关资源
    最近更新 更多