【Github】SourceTree远端链接Github

一、使用git生成公私钥

  1. 在Git bash中输入如下内容:
    如果没有Git bash需要下载一个Git bash。

git config --global user.name "xxx"

git config --global user.email "xxx.mail@xxx.com"

其中,xxx建议写成Github名称,email建议写成注册Githu的email。

生成ssh密钥

ssh-keygen -t rsa -C "xxx.mail@xxx.com"

第一次回车后输入y,后面两次直接按回车

二、在soure tree添加SSH Key

1.点击工具 -> 选项

配置OpenSSH客户端

三、配置github服务器

登录github服务器, https://github.com/settings/keys ,添加SSH Key。

  1. 点击New ssh key
  2. id_rsa.pub内容关联
    将C盘中的 .ssh文件夹中的id_rsa.pub 文件的内容(记事本打开)复制到Key,Title随机命名。

四、SourceTree 下载 git 项目

  1. 复制你的 git 地址(ssh地址)

  2. 点击clone,将地址粘贴在路径中: