簡體   English   中英

git命令授權失敗后ssh授權成功連接git@github.com

[英]git commands fail to authorize after ssh authorization succeed to connect to git@github.com

我在 github 上創建了一個私有 git 存儲庫。 我運行命令ssh-keygen -t ed25519 -C "me@gmail.com" -f ".\id_ed22519_me"ssh-add.\id_ed22519_me來創建私鑰和公鑰,並將公共 ssh 密鑰添加到 ZBF215181B51405B5414736 我還設置了以下配置以使用正確的鍵:

#~/.ssh/config
Host github.com-me
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed22519_me
  IdentitiesOnly yes

但是,當我嘗試使用 git 命令時,出現以下錯誤:

#powershell
PS C:\Path\to\Project> ssh -T git@github.com
   Hi me! You've successfully authenticated, but GitHub does not provide shell access.

PS C:\Path\to\Project> git push --set-upstream origin master
   git@github.com: Permission denied (publickey).
   fatal: Could not read from remote repository.

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

誰能知道會導致什么? 我還確保我對遠程“原點”使用正確的 url,並且我的分支確實是“主”

https://gist.github.com/jexchan/2351996#gistcomment-522294這似乎解決了我的問題。 我有點奇怪,我必須將我的用戶名 append 到 URL,但它有效 ^^

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM