使用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

相關文章
相關標籤/搜索