安裝githtml
設置git 用戶名和郵箱git
$ git config --global user.name "Your Name"github
$ git config --global user.email "email@example.com"shell
打開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 爲對外使用的
登錄github 點擊右上角 選中設置 添加sshkey 輸入 id_rsa.pub 中的內容便可
最後將本地倉庫push到github
注意remote 要添加 ssh 的地址
可使用git remote get-url 或者 git remote remove +git remote add
命令修改url