繁体   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