使用 SSH 连接 Github
生成新的 SSH Key
1ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
2...
3Enter a file in which to save the key (/home/you/.ssh/algorithm): <key_name>
4Enter passphrase (empty for no passphrase): [输入密码]
5Enter same passphrase again: [再次输入密码]
将新的 SSH Key 添加到 Github
- 将公钥文件的内容COPY出来
1cat ~/.ssh/<key_name>.pub
- Github.com -> "Settings" -> "SSH and GPG keys" -> "New SSH key"
Title : 为新密钥添加描述性标签 Key : 粘贴COPY的公钥内容
- "Add SSH key"
使用 SSH 连接到 Github
- ssh config
1cd ~/.ssh
2# 设置访问权限
3chmod 600 <key_name>
4# 生成SSH配置文件
5cat > config << EOF
6Host github.com
7 Hostname ssh.github.com
8 Port 443
9 IdentityFile ~/.ssh/<key_name>
10 UpdateHostKeys yes
11 Compression yes
12 User git
13EOF
- 连接测试
1ssh -T git@github.com
2...
3Are you sure you want to continue connecting (yes/no)? <yes>
4...
5Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.
自动验证
如果找不到软件,直接下载安装 或 更换软件源 Linux 版本库管理
1# debian
2apt install -y keychain
3# centos
4yum install -y keychain
5# alpine linux
6apk add keychain
7
8# debian or centos in ~/.bashrc or ~/.bash_profile
9# alpine linux in /etc/profile.d/30user.sh
10echo "eval `keychain --eval ~/.ssh/<key_name>`" >> ~/.bashrc
11...
12 * Adding 1 ssh key(s): /home/<username>/.ssh/<key_name>
13 * ssh-add: Identities added: /home/<username>/.ssh/<key_name>
相关专栏文章
- Nuitka 参数列表
- ProxmoxVE 配置 DHCP 网络
- Windows防火墙配置
- 在 CentOS 上部署 NetBIOS
- Tmux 命令
- 配置 CentOS 7 的 CT 容器
- Ncftp 使用手册
- Centos7 安装 Postgresql
- 在CentOS中安装 Laravel 框架
- 虚拟主机安装 Laravel 框架
- snap 设置代理
- Rime输入法设置
- Windows系统配置
- 灌篮高手大结局(全国大赛后) 下
- 灌篮高手大结局(全国大赛后) 上
- VScode 在 Docker 容器内开发
- VSCode 配置 Python 开发环境
- ProxmoxVE 配置 BBR
- ProxmoxVE 关闭订阅提示
- Linux 文本文件操作
- Deepin 使用远程桌面
- Hyper-V 下设置 Deepin 分辨率
- VsCode 使用 Remote SSH 连接 Alpine Linux
- Alpine Linux 安装 Bash
- frp安装配置
- Alpine Linux 配置
- screen 命令
- Systemd 系统工具命令指南
- ProxmoxVE 命令行
- Hyper-V 环境下给 CentOS 磁盘扩容
- Hyper-V 下设置 Ubuntu 分辨率
- Windows 10 家庭版安装 Hyper-V
- Hyper-V 网络设置
- Docker Compose 指令
- 使用 SSH 连接 Github
- Alpine Linux 安装 Docker
- Alpine Linux 网络设置
- 虚拟机安装 Alpine Linux 3.16
- 山克 UPS 安装手册
- Git 命令行
- 使用 Snap 安装 Docker
- (CentOS 7 | Rocky 9) 安装 Docker
- 修复 ProxmoxVE RRD 错误
- FFmpeg脚本
- Yum 版本库管理
- Linux系统内核升级
- iptables 配置
- ProxmoxVE 配置 NAT 网络
- MySQL 数据操作
- 使用 nmcli 配置网络
- 使用 sed 命令操作
- Linux 系统初始化配置
- Github使用Hugo生成Blog
- Docker使用命令
- About
- Search