First of all, I have got the ssh key. ssh -T git@githun.com is ok and returns:
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
However, when I want to git push, it always fails. The prompt is:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: xxxxxxxxxxxx
May I ask what is going on?
I executed
git remote add origin git@github.com:xxxxxxx/test.git
git push -u origin master
Set Git user name and email
Generate SSH Key
Add key to ssh: ssh-add file name, you need to enter the password before.
Add the ssh key on github. What you need to add is the public key in "id_rsa.pub".
Open https://github.com/ and add the key in the settings