Please note: I first log in into my ec2 server with ssh.
Then I created a new ssh key. Generating it gave me these files:
id_ed25519.pub
id_ed25519
I opened the setting page at github and added a new ssh-key. I entered the content of "id_ed25519.pub".
I go back to my ec2 instance and run this command:
git clone git@github.com:myusername/myrepo.git
What I get is this error:
Permission denied (publickey).
If I run this:
ssh -Tv git@github.com
then I get this message:
Hello username. You've successfully authenticated, but GitHub does not provide shell access.
Why am I not able to clone the repo?
Assuming you are running ssh -Tv git@github.com
from the same ECS environment you are attempting your clone, said clone should work.
You can compare the ssh -Tv git@github.com
output (which works) with your git clone by doing:
export GIT_SSH_COMMAND='ssh -Tv'
git clone git@github.com:myusername/myrepo.git
You will see if the git clone use attempting to use the same keys as your ssh did.
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.