-
生成public/private key pair
ssh-keygen -t rsa -C "github賬號的郵箱"
-
進入存放密鑰的目錄,複製public key的內容
-
將public key添加到github上
-
免密pull, push
# 在緩存中寫入賬號密碼,接下來15minutes內可免密pull, push git config --global credential.helper cache # 在磁盤中寫入賬號密碼,下次pull, push時直接從磁盤中讀取 git config --global credential.helper store # 這種方式的缺點是你的密碼是用明文的方式存放在你的 home 目錄下
-
第一次pull/push需要輸入賬號密碼,接下來就可以快速的push啦!
-
刪除保存在 cache/store 中的Git賬號密碼
# 在root權限下 git config --system --unset credential.helper
想了解配置ssh的詳情可移步:雲服務器配置ssh登陸(putty + puttygen)