Commit to github
Generating key
ssh-keygen -t rsa -C "youremail@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/y/.ssh/id_rsa):
/home/y/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/y/.ssh/id_rsa.
Your public key has been saved in /home/y/.ssh/id_rsa.pub.
The key fingerprint is:
Add ssh key in git.
xclip -sel clip < ~/.ssh/id_rsa.pub
Check
ssh -T git@github.com
Succeed
Hi *! You've successfully authenticated, but GitHub does not provide shell access.
Error
ssh -T git@github.com
sign_and_send_pubkey: signing failed: agent refused operation
git@github.com: Permission denied (publickey).
ssh-agent -s
ssh-add
Identity added: /home/y/.ssh/id_rsa (/home/y/.ssh/id_rsa)
Warning
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/y/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Permissions 0744 are too open.
chmod 600 /home/y/.ssh/*
Identity added: /home/y/.ssh/id_rsa (/home/y/.ssh/id_rsa)
本文详细介绍了如何在GitHub上使用SSH密钥进行安全的代码推送。从生成SSH密钥对,到添加密钥到SSH agent,再到在GitHub上添加SSH公钥,以及常见错误的排查,如权限设置不当导致的警告,提供了全面的操作步骤。
2297

被折叠的 条评论
为什么被折叠?



