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

相關文章
相關標籤/搜索