Git SSH 配置

SSH 配置

密钥生成

打开 Git Bash ,使用 ssh-keygen 生成 ssh 密钥

bash 复制代码
 ssh-keygen -t ed25519 -C "<emial>"
  • -t:指定密钥类型,这里是 ed25519
  • -C:指定邮箱,即仓库系统的 SSH 邮箱
plain 复制代码
Enter file in which to save the key  # 文件存放路径
Enter passphrase for # 填写密码

The key fingerprint is:
SHA256:5z4qxxxxxXXXXXXXXXO0 8xxxxxX5@qq.com
The key's randomart image is:
+--[ED25519 256]--+
|                 |
|  				  |
+----[SHA256]-----+

打开系统 SSH 服务并添加密钥到系统账户

通过 PowerShell 操作

检查服务

bash 复制代码
Get-Service -Name ssh-agent | Set-Service -StartupType Manual

开启服务

bash 复制代码
Start-Service ssh-agent

添加密钥

bash 复制代码
ssh-add c:/Users/YOU/.ssh/id_ed25519

Github 添加 SSH 密钥

复制公钥到剪切板

bash 复制代码
 clip < /c/Users/YOU/.ssh/id_ed25519.pub

在 Github -> 个人设置 -> SSH and GPG key 中填入公钥消息

GitLab(极狐) 添加 SSH 密钥

在 SSH Keys 配置中,将得到的 .pub 公钥复制到 下方的密钥输入框,添加后即可通过 SSH 访问仓库

后续可以通过 SSH 完成仓库克隆,避免 HTTPS 443 限制问题

复制代码
git clone git@github.com:vuejs/core.git
相关推荐
sharemylove6 小时前
Java集合框架全面详解
java·开发语言·经验分享·笔记·学习
whyTeaFo6 小时前
GAMES202: Lecture 3: Real-Time Shadows 1 ppt笔记
笔记
`流年づ6 小时前
联邦学习-安全聚合
git·安全·github
摇滚侠8 小时前
《On Java 中文版 基础卷》阅读笔记 内部类 20
java·笔记·python
喜欢吃燃面10 小时前
Git 原理与使用(三):标签、多人协作与 Git Flow 落地
大数据·git·elasticsearch
旖旎夜光12 小时前
LeetCode 493: 翻转对 (归并排序) —— 题解
c++·笔记·学习·算法·leetcode·排序算法
吃我一窝jio13 小时前
Java IO流核心分类与应用
java·开发语言·笔记
喜欢吃燃面15 小时前
Git 原理与使用(二):分支是平行宇宙,远程仓库是共享时空
大数据·git·elasticsearch
Uio24116 小时前
Java HashMap 底层原理详解(JDK1.8 优化、哈希冲突、红黑树、面试必问)
笔记
inferno16 小时前
Java正则表达式学习笔记
java·笔记·学习·正则表达式