使用ssh方式 链接到github

 

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

 

准备步骤

安装gitgit

设置git 用户名和邮箱github

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

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

 

配置SSH key

1.建立ssh keyssh

打开shell  这里使用git bashui

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

建立keyspa

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

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

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

其中 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 

相关文章
相关标签/搜索