git gui设置github sshkey

要在 Git GUI 中生成 SSH 密钥,请按以下步骤操作:

方法 1:使用 Git GUI 的密钥生成工具

步骤:

  1. 打开 Git GUI

    bash 复制代码
    git gui
  2. 进入帮助菜单

    • 菜单栏点击 Help
    • 选择 Show SSH Key
  3. 生成新密钥

    • 点击 Generate Key
    • 选择密钥类型(RSA 2048/4096 或 ED25519)
    • 可选:设置密码(Passphrase)
    • 点击 Generate
  4. 复制公钥

    • 生成后,公钥会显示在文本框
    • 点击 Copy To Clipboard
    • 或者手动复制整个内容

方法 2:在 Git GUI 中配置现有密钥

步骤:

  1. 打开 Git GUI

  2. 进入 Edit 菜单

    • 点击 Edit
    • 选择 Options
  3. 配置 SSH

    • 左侧选择 SSH
    • 在 "SSH executable" 选择:
      • ssh(使用系统 OpenSSH)
      • plink(使用 PuTTY)
    • 如果需要,指定 SSH 密钥路径
  4. 手动指定密钥路径

    复制代码
    C:\Users\zs_lo\.ssh\id_ed25519

方法 3:在 Git Bash 中生成(推荐)

  1. 打开 Git Bash(不是 GUI)

    bash 复制代码
    # 在开始菜单搜索 "Git Bash"
  2. 运行生成命令

    bash 复制代码
    ssh-keygen -t ed25519 -C "your_email@example.com"
  3. 按提示操作

    复制代码
    Enter file in which to save the key (/c/Users/zs_lo/.ssh/id_ed25519): [回车]
    Enter passphrase: [回车或设置密码]
  4. 显示公钥

    bash 复制代码
    cat ~/.ssh/id_ed25519.pub
  5. 复制输出内容

方法 4:使用 Git GUI 的设置验证

  1. 打开 Git GUI

  2. 选择 "Open SSH Keys Folder"

    • 菜单:Help → Show SSH Key
    • 点击 "Open SSH Keys Folder"
    • 这会打开 .ssh 目录
  3. 查看现有密钥

    • 找到 .pub 文件(公钥)
    • 用记事本打开
    • 复制全部内容

验证 SSH 配置

在 Git Bash 中测试:

bash 复制代码
# 测试 SSH 连接(示例)
ssh -T git@github.com

# 列出所有密钥
ssh-add -l

# 添加密钥到代理
ssh-add ~/.ssh/id_ed25519

如果你要设置特定平台的 SSH

GitHub / GitLab / Gitee:

  1. 生成密钥后
  2. 登录网站
  3. 在 Settings → SSH Keys 中添加
  4. 粘贴复制的公钥

常见路径:

  • 密钥存储位置:C:\Users\zs_lo\.ssh\
  • 公钥文件:id_ed25519.pubid_rsa.pub
  • 私钥文件:id_ed25519id_rsa

快速开始命令

如果你想要最简单的方法,在 Git Bash 中运行:

bash 复制代码
# 1. 生成
ssh-keygen -t ed25519 -f ~/.ssh/id_openclaw -N "" -C "openclaw@$(hostname)"

# 2. 显示
cat ~/.ssh/id_openclaw.pub

# 3. 复制输出(从 ssh-ed25519 开始到最后)

然后把这个公钥粘贴到你需要的地方。

相关推荐
极光技术熊6 小时前
Spring AI 从入门到精通:构建你的 AI 开发知识体系
后端·github
用户39483951075537 小时前
怎么让我的 Agent 真正"懂"我?——关于记忆、经验学习与预测的一些真实体验
github
远航_13 小时前
git submodule
前端·后端·github
fthux14 小时前
如果你用 Mac,那你可能需要 Noti Shift
macos·开源·github
程序员天天困1 天前
Loop Engineering 实战:/goal 命令让 AI 自己写完整项目
github
徐小夕1 天前
我们开源了一款“框架无关”的思维导图编辑器,3分钟集成到任意系统
前端·javascript·github
小爷毛毛_卓寿杰1 天前
我把 397B 的「Agentic 大脑」塞进了 Xinference,一键部署 Nex-N2
人工智能·架构·github
小爷毛毛_卓寿杰1 天前
我把一个 3B 模型塞进了 Xinference,然后它干掉了 DeepSeek V3.2
人工智能·开源·github
凌奕1 天前
别用文档约束你的 Agent:聊聊 Agent 开发流程的思想
llm·github·agent
和你看星星1 天前
Git rerere:让重复冲突只解决一次
git