git ssh登陆

2018-09-12  本文已影响0人  Nick_4438

生成秘钥文件

ssh-keygen -t rsa -C 'nick@xx.com' -f ~/.ssh/github
cat github.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/0cOZeaajHo1gMFU7APUn1QWPGrdtIFAdfFuYCw0xdEIgd8fKaRNanVTm/mrVXgSRy11Est1mtS6PQhu1Yiq6VHdtWMKpc8TlkxC9OpISaf4p+Hkkzv4G+jQK2NCVgPnkJ383GCDobbKoq1o/mSNKxkMLGBFjgEohe6vHwXEX9QkHmIlLPWG6aTIV+FkQcB+avIh6jObPrsUfLU9TubdZdwVrtsgOeqcVrQr+LyNGZU2ytF4+lRz2IOM5e3cam7jMeBHzgQGmojz4e9tc/HFqiUXg3pcihSthJc0DzTgNTJij49K6U0OOURhUChxnc1C+8Iadts9q5EfaU2AJlwrhj qiujiahongde@163.com
ssh-add ~/.ssh/github
Enter passphrase for /Users/fangle/.ssh/github: 
Identity added: /Users/fangle/.ssh/github (/Users/fangle/.ssh/github)

导入ssh key到github上

image.png

测试登陆

ssh -T git@github.com
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Hi qiujiahong! You've successfully authenticated, but GitHub does not provide shell access.

补充说明,gitlab上面的设置方法类似,读者可以通过以上方法设置多个git链接多个服务器;

上一篇 下一篇

猜你喜欢

热点阅读