github ssh ssh-keygen

生成和使用 SSH 密钥对是一种安全的身份验证方式,用于在你的本地系统和 GitHub 之间进行身份验证。以下是在 GitHub 上生成和使用 SSH 密钥对的基本步骤:

1. 生成 SSH 密钥对

在命令行中执行以下命令来生成 SSH 密钥对:

ssh-keygen  -C "your_email@example.com"
  • -C "your_email@example.com": 添加注释,一般填写你的 GitHub 注册邮箱。

在执行命令时,你可以选择为密钥对选择一个自定义的文件名和路径,或者直接按 Enter 使用默认路径(一般是 ~/.ssh/id_rsa)。

2. 将 SSH 密钥添加到 GitHub

使用以下命令将公钥添加到 GitHub。你需要将 ~/.ssh/id_rsa.pub 文件中的内容复制并粘贴到 GitHub 的 SSH 设置中。

cat ~/.ssh/id_rsa.pub

在这里插入图片描述在这里插入图片描述

3. 测试 SSH 连接

使用以下命令测试 SSH 连接是否正常:

ssh -T git@github.com
(base) pdd@pdd-Dell-G15-5511:~$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
(base) pdd@pdd-Dell-G15-5511:/etc/apt$ vim ~/.ssh/config
(base) pdd@pdd-Dell-G15-5511:/etc/apt$ cat ~/.ssh/config
Host github.com
 Hostname ssh.github.com
 Port 443
(base) pdd@pdd-Dell-G15-5511:~$ ssh -T git@github.com
Hi *****! You've successfully authenticated, but GitHub does not provide shell access.

Git报错: Failed to connect to github.com port 443

# https://blog.csdn.net/ResumeProject/article/details/128594105
git config --global --replace-all https.proxy 192.168.31.203:7890
git config --global --replace-all http.proxy 192.168.31.203:7890

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-01-26 07:28:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-26 07:28:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-26 07:28:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-26 07:28:01       20 阅读

热门阅读

  1. Dockerr开发环境搭建

    2024-01-26 07:28:01       36 阅读
  2. 阿里云centos安装mysql,并修改初始密码

    2024-01-26 07:28:01       42 阅读
  3. SQL中的DML、DDL以及DCL是什么?

    2024-01-26 07:28:01       37 阅读
  4. 常用的gpt-4 prompt words收集7

    2024-01-26 07:28:01       33 阅读
  5. centos搭建离线仓库

    2024-01-26 07:28:01       35 阅读
  6. Git进阶

    2024-01-26 07:28:01       36 阅读
  7. 制作一个简单的HTML个人网站

    2024-01-26 07:28:01       32 阅读
  8. 登录注册页面

    2024-01-26 07:28:01       29 阅读
  9. 如何本地测试一个websocket的接口

    2024-01-26 07:28:01       36 阅读
  10. 项目遇到Bug如何解决(思路)

    2024-01-26 07:28:01       29 阅读