Skip to content

Latest commit

 

History

History
52 lines (30 loc) · 1.69 KB

File metadata and controls

52 lines (30 loc) · 1.69 KB

git安装和ssh配置

  1. 下载和安装Git

    https://git-scm.com/downloads

  2. 生成ssh公钥和私钥

  3. 公钥复制到GitHub/GitLab的个人设置里(假设使用的ssh key类型是rsa)

    • 直接拷贝~/.ssh/id_rsa.pub里的公钥到GitHub/GitLab个人账户Settings下的SSH and GPG keys里。
    • 拷贝命令参考:Windows用clip < ~/.ssh/id_rsa.pub,Mac用pbcopy < ~/.ssh/id_rsa.pub,Linux用xclip命令。
  4. 测试连接

    • 执行以下命令:

      ssh -T git@github.com

      出现Are you sure you want to continue connecting (yes/no/[fingerprint])?时,要输入yes,不能直接回车,否则就不会在.ssh目录下生成known_hosts文件,后面clone代码会出错。

    • 当看到如下结果就表示大功告成了。

      Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
  5. 下载代码

    • 上面的1-4操作完成后,就可以git clone代码了。

References