新安裝了Windows 11,創建密鑰對ssh-keygen -t rsa -C "[email protected]"命令,并上傳在內容id_rsa.pub檔案到git的服務器,然后運行git clone git@server:user/repo中windows terminal powershell,然后我得到了筆記的權限被拒絕。
我已經確認我上傳的公鑰是正確的,并且可以從
git bash、cygwin terminal和正確訪問私鑰檔案windows terminal powershell。我嘗試洗掉密鑰對并重新生成一個然后上傳,這是無能為力的。
我試圖更改一個 git 服務器,包括
coding.net,gitee.com和github.com,并且報告是相同的。(與Permission denied)我確認遠程 git repo 存在。
我確認我可以通過 https 和用戶名密碼身份驗證正確訪問 git repo。
我嘗試在我的 mac 或 linux 上克隆 repo,它們沒問題。
我在這個網站上搜索了一些帖子后,我嘗試了ssh -v [email protected],然后得到了下面的報告:
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to gitee.com [212.64.62.183] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\ye/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\ye/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\ye/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\ye/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\ye/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\ye/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\ye/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\ye/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\ye/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\ye/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version ssh-pilot-1.1.1
debug1: no match: ssh-pilot-1.1.1
debug1: Authenticating to gitee.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256: ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88
debug1: Host 'gitee.com' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\ye/.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
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\ye/.ssh/id_rsa RSA SHA256:vjf1QWcO 923/akAbAnZybgl L9eJBDDTDtKyqvXdkA
debug1: Will attempt key: C:\\Users\\ye/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\ye/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\ye/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\ye/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\ye/.ssh/id_rsa RSA SHA256:vjf1QWcO 923/akAbAnZybgl L9eJBDDTDtKyqvXdkA
debug1: Server accepts key: C:\\Users\\ye/.ssh/id_rsa RSA SHA256:vjf1QWcO 923/akAbAnZybgl L9eJBDDTDtKyqvXdkA
debug1: Authentication succeeded (publickey).
Authenticated to gitee.com ([212.64.62.183]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi Lagom! You've successfully authenticated, but GITEE.COM does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to gitee.com closed.
Transferred: sent 3084, received 1512 bytes, in 0.2 seconds
Bytes per second: sent 15886.8, received 7788.8
debug1: Exit status 0
似乎我有權訪問 git 服務器,但這是我重新運行git clone命令后收到的內容。
PS D:\Workspace> git clone [email protected]:username/demo-repo.git
Cloning into 'demo'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我該怎么做才能使它正確?
uj5u.com熱心網友回復:
你好用戶名!您已成功通過身份驗證,但 GITEE.COM 不提供外殼訪問。
您的密鑰適用于基本身份驗證,但您仍然無法克隆username/demo-repo.git(假設“ username”與Hi username!訊息中的相同)
正如我之前提到的,您可能需要創建一個 ed25519 密鑰:
cd %USERPROFILE%\.ssh
ssh-keygen -t ed25519 -C "[email protected]" -P "" -f gitee
而一個%USERPROFILE%\.ssh\config與
Host gitee
Hostname gitee.com
User git
Identityfile ~/.ssh/gitee
最后:(git clone gitee:username/demo-repo.git不[email protected],只是gitee)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/352846.html
上一篇:GitHub合并拉取請求沖突
