Skip to content

上午

下午
创建GitHub仓库的ssh密钥 命令:ssh-keygen -t ed25519 -f C:\Users\zuonian.ssh\github-ssh\github-ssh 会生成两个文件:Your identification has been saved in C:\Users\zuonian.ssh\github-ssh\github-ssh Your public key has been saved in C:\Users\zuonian.ssh\github-ssh\github-ssh.pub 其中.pub文件(公钥)复制到GitHub的SSH Keys中 需要把公钥添加到你的 GitHub 个人账户 中,而不是某个具体的仓库设置里。 操作路径: 点击页面右上角的个人头像。 选择 Settings(设置)。 在左侧侧边栏中,找到并点击 SSH and GPG keys。 点击 New SSH key 按钮。 将你生成的公钥内容(通常是 github-ssh.pub 文件里的内容)粘贴进去并保存。

本机:
指定ssh的连接:
    1. 创建config文件,文件路径 C:\Users\zuonian\.ssh\config
    2. 添加内容:
        # 针对 GitHub 的配置
        Host github.com
            HostName github.com
            User git
            IdentityFile ~/.ssh/github-ssh/github-ssh
测试连接的命令:ssh -T git@github
成功则返回:
Hi zhuo-nian! You've successfully authenticated, but GitHub does not provide shell access.

小问题:Linux系统中的tab键会用到几个空格