当前位置: 首页 > news >正文

Ubuntu 配置 Github 的 SSH keys

先进入已有的 Git 目录或使用新建的一个 Git 仓库下。

设置 Github 用户名和邮箱:

$ git config --global user.name [Github用户名]
$ git config --global user.email [Github认证邮箱]

生成 SSH 密钥文件:

$ ssh-keygen -t rsa -C [Github认证邮箱]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): 
[按 Enter 键接受默认文件位置]
Enter passphrase (empty for no passphrase): 
[按 Enter 不设置安全口令, 如果设置, 每次使用 Git 命令时都需要输入]
Enter same passphrase again:
[重复安全口令, 如果上一步没有设置, 按 Enter 跳过]

~/.ssh/ 目录下会创建两个文件:

  • id_rsa: 私钥文件
  • id_rsa.pub: 公钥文件

将公钥文件内容打印后复制:

$ cat ~/.ssh/id_rsa.pub

登陆 Github 点击 右上角头像 -> Settings -> SSH and GPG keys -> New SSH key 输入以下内容:

  • Title: 任意取名
  • Key type: Authentication Key
  • Key: 复制上一步中的公钥文件内容到此处

点击 Add SSH key 完成创建, 验证 Authentication 是否正常:

$ ssh -T git@github.com
The authenticity of host 'github.com (0.0.0.0)' can't be established.
ED25519 key fingerprint is SHA256:+xxxxxxxxx/xxxxxxxxx.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? 
[选择 yes 使服务器的连接信息保存在系统中]
Warning: Permanently added 'github.com' (ED0000) to the list of known hosts.
Hi [Github用户名]! You've successfully authenticated, but GitHub does not provide shell access.

最后输出 Hi [Github用户名]! You've successfully authenticated, but GitHub does not provide shell access. 就表示配置成功了。

http://www.lryc.cn/news/226027.html

相关文章:

  • Flink—— Flink Data transformation(转换)
  • 前端读取文件当文件选择相同文件名的文件,内容不会变化
  • PHP 服装销售管理系统mysql数据库web结构layUI布局apache计算机软件工程网页wamp
  • 用于图像处理的高斯滤波器 (LoG) 拉普拉斯
  • 【h5 uniapp】 滚动 滚动条,数据跟着变化
  • ModStartBlog v8.5.0 评论开关布局调整,系统后台全面优化
  • django|报错SQLite 3.8.3 or later is required的解决方案
  • 通达OA get_datas.php前台sql注入-可获取数据库session登入后台漏洞复现 [附POC]
  • 苹果官方:所有国行iPhone 15系列都在中国生产!
  • Oracle 安装及 Spring 使用 Oracle
  • element-ui 表格 点击选中
  • 畅通工程之局部最小花费问题 (C++)
  • Sql 异常 + Error
  • 基于UNI-APP实现适配器并保证适配器和实现的调用一致
  • 使用jdk21预览版 --enable-preview
  • js中的跳转都有哪些格式
  • 无重复字符的最长子串
  • C语言--输入10个数字,要求输出其中值最大的元素和该数字是第几个数
  • 如何做好功能测试,提升测试质量和效率?
  • 高德地图添加信息弹窗,信息弹窗是单独的组件
  • Apache Arrow优点
  • 【Linux权限:系统中的数字锁与安全之门】
  • 笔记本电脑的麦克风没有声音
  • 20道简单的投资数学逻辑
  • 【Spring】事务实现原理
  • 人工智能基础_机器学习024_梯度下降进阶_L1正则可视化图形---人工智能工作笔记0064
  • 媒体聚焦丨四维图新旗下杰发科技王璐:设计决定芯片质量
  • 动态规划基础篇(LeetCode每日一题计划)
  • 智慧商业:探索分布式云技术为企业创造商业价值,减少成本,提升生产力的秘诀!
  • Anaconda安装gdal