使用ssh方式 链接到github

准备步骤

安装githtml

设置git 用户名和邮箱git

$ git config --global user.name "Your Name"github

$ git config --global user.email "email@example.com"shell

 

配置SSH key

1.建立ssh key

打开shell  这里使用git bashbash

$ ssh-keygen -t rsa -C "youremail@example.com"ssh

建立keyui

 

会有以上问题 一路回车便可url

使用默认值便可,因为这个Key也不是用于军事目的,因此也无需设置密码。spa

会默认在  C:\Users\s\.ssh  这个文件家下 建立id_rsa   id_rsa.pub 两个文件htm

其中 id_rsa.pub 为对外使用的

 

2.在github上配置

 

登录github 点击右上角 选中设置  添加sshkey   输入 id_rsa.pub 中的内容便可

push 到github

最后将本地仓库push到github  

注意remote 要添加 ssh 的地址

可使用git remote get-url 或者  git remote remove +git remote add

命令修改url 

 

参考:http://cuiqingcai.com/423.html

相关文章
相关标签/搜索