简体   繁体   中英

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

I have created a private git repo on github. I ran the commands ssh-keygen -t ed25519 -C "me@gmail.com" -f ".\id_ed22519_me" and ssh-add.\id_ed22519_me to create the private and public keys, and added the public ssh key to github. I also have setup the following config to use the correct keys:

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

However when I try to use the git command I get the following error:

#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.

Can anyone know what could lead to that? I also have made sure that I use the correct url for the remote "origin", and that my branch is indeed "master"

https://gist.github.com/jexchan/2351996#gistcomment-522294 This appears to resolve my issue. I'm a bit weirded out that I have to append my username to the URL, but it works ^^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM