使用https:// 提交GitHub上的私有項目時,須要每次都輸入賬號和密碼,比較麻煩。dom
好比我本身的筆記本,在push的時候我可不想每次都輸入這些。ssh
那就使用SSH吧,這個須要在GitHub的賬號上添加這檯筆記本的SSH key。ide
① ssh-keygen -t rsa -C "name@domain.com"開發
引號中輸入一個電子郵件地址信息便可。it
② Enter file in which to save the key (/home/you/.ssh/id_rsa):io
這是選擇生成Key的保存路徑,默認便可。file
③ Enter passphrase (empty for no passphrase):[Type a passphrase]rsa
Enter same passphrase again:[Type passphrase again]下載
這是輸入本地ssh用戶的密碼,若是筆記本只有你一我的開發的話,建議不填寫密碼。密碼
④ your identification has been saved in /home/you/.ssh/id_rsa.
your public key has been saved in /home/you/.ssh/id_rsa.pub.
告訴你生成的本地證書和公共key的生成路徑。
⑤ 將id_rsa.pub中的內容複製到GitHub賬號的SSH keys裏。
OK,使用ssh下載項目,能夠不用每次提交都輸入用戶名和密碼了。