github ssh 连接初步

本文详细介绍了如何在本地计算机上生成GitSSHKey,包括设置Git的用户名和邮箱、生成SSH密钥、添加密钥到SSH代理以及测试连接过程。通过本教程,读者可以学会如何安全地使用SSH进行Git仓库的远程操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Git SSH Key 生成步骤
  • 一 :设置Git的user name 和email
    • $ git config --global user.name "你的用户名"
    • $ git config --global user.email "git注册邮箱"
  • 二 : 生成ssh秘钥的过程:
  1. 查看是否已经有了ssh密钥:cd ~/.ssh 如果没有密钥则不会有此文件夹,有则备份删除
  2. 生存密钥: $ ssh-keygen -t rsa -C "git注册邮箱" 按3个回车,密码为空。 Your identification has been saved in /home/tekkub/.ssh/id_rsa. Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub. The key fingerprint is: ………………

最后得到了两个文件:id_rsa和id_rsa.pub

  1. 添加密钥到ssh:ssh-add 文件名 需要之前输入密码。

  2. 测试:

  • $ ssh git@github.com The authenticity of host 'github.com (192.30.252.123)' 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.252.123' (RSA) to the list of known hosts. PTY allocation request failed on channel 0 Hi duanqichao1993! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.

转载于:https://my.oschina.net/u/2558794/blog/700991

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值