git ssh登陆
【摘要】 生成秘钥文件示例如下,这里给文件取名github, 密码任意输入ssh-keygen -t rsa -C 'nick@xx.com' -f ~/.ssh/githubcat github.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/0cOZeaajHo1gMFU7APUn1QWPGrdtIFAdfFuYCw0xdEIgd8fKaRNanVTm/mr...
生成秘钥文件
示例如下,这里给文件取名github, 密码任意输入
ssh-keygen -t rsa -C 'nick@xx.com' -f ~/.ssh/githubcat github.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/0cOZeaajHo1gMFU7APUn1QWPGrdtIFAdfFuYCw0xdEIgd8fKaRNanVTm/mrVXgSRy11Est1mtS6PQhu1Yiq6VHdtWMKpc8TlkxC9OpISaf4p+Hkkzv4G+jQK2NCVgPnkJ383GCDobbKoq1o/mSNKxkMLGBFjgEohe6vHwXEX9QkHmIlLPWG6aTIV+FkQcB+avIh6jObPrsUfLU9TubdZdwVrtsgOeqcVrQr+LyNGZU2ytF4+lRz2IOM5e3cam7jMeBHzgQGmojz4e9tc/HFqiUXg3pcihSthJc0DzTgNTJij49K6U0OOURhUChxnc1C+8Iadts9q5EfaU2AJlwrhj qiujiahongde@163.com
专用密钥添加到ssh-agent的高速缓存中(下面github是第一步取的文件名)
ssh-add ~/.ssh/github Enter passphrase for /Users/fangle/.ssh/github: Identity added: /Users/fangle/.ssh/github (/Users/fangle/.ssh/github)
导入ssh key到github上
测试登陆
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链接多个服务器;
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)