34 lines
805 B
Plaintext
34 lines
805 B
Plaintext
|
|
# SSH 密钥配置步骤 - 快速参考
|
|||
|
|
|
|||
|
|
## 在 Git Bash 中执行:
|
|||
|
|
|
|||
|
|
# 1. 生成 SSH 密钥
|
|||
|
|
ssh-keygen -t ed25519 -C "admin@example.com"
|
|||
|
|
# 按回车使用默认路径,可以设置密码或留空
|
|||
|
|
|
|||
|
|
# 2. 查看公钥(复制全部内容)
|
|||
|
|
cat ~/.ssh/id_ed25519.pub
|
|||
|
|
|
|||
|
|
# 3. 将公钥添加到 Gerrit:
|
|||
|
|
# - 访问: http://101.43.95.130:8080/#/settings/ssh-keys
|
|||
|
|
# - 点击 "Add Key"
|
|||
|
|
# - 粘贴公钥内容
|
|||
|
|
# - 保存
|
|||
|
|
|
|||
|
|
# 4. 删除旧的 known_hosts 条目
|
|||
|
|
ssh-keygen -R [101.43.95.130]:29418
|
|||
|
|
|
|||
|
|
# 5. 测试 SSH 连接
|
|||
|
|
ssh -p 29418 admin@101.43.95.130
|
|||
|
|
# 输入 yes 接受新密钥
|
|||
|
|
# 输入 exit 退出
|
|||
|
|
|
|||
|
|
# 6. 配置 Git 使用 SSH
|
|||
|
|
cd /d/zhini/zhini_im
|
|||
|
|
git remote remove gerrit
|
|||
|
|
git remote add gerrit ssh://admin@101.43.95.130:29418/zhini_im
|
|||
|
|
|
|||
|
|
# 7. 推送代码
|
|||
|
|
git push gerrit HEAD:refs/heads/master
|
|||
|
|
|