解決git push/pull 每次都要輸入密碼、ssh-keygen
阿新 • • 發佈:2018-05-21
mage 打開終端 utf div span 中文亂碼 bubuko XA lob
一、問題描述
以github為例
每次在向github服務器 推送代碼(git push),都會提示輸入用戶名密碼
二、問題原因
在clone 代碼時使用的是HTTS協議
三、解決方法
1.clone代碼時使用SSH協議
2.本地git配置 打開終端
-----------------------系統配置------------------------------------ git config --global core.quotepath false //支持utf-8編碼 解決中文亂碼 git config --global user.name username git config--global user.email [email protected] -----------------------系統配置------------------------------------
3.生成一個新密鑰並將它添加到github
#1 打開終端,輸入一下文本,替換自己的github郵箱地址 # 註意:生成秘鑰的時候,會提示輸入密碼,直接默認回車, $ssh-keygen -t rsa -b 4096 -C "[email protected]" #2 生成的公鑰和私鑰在 /home/you/.ssh/目錄下 id_rsa 和id_rsa.pub #3 復制公鑰 $ cat /home/you/.ssh/id_rsa.pub
----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
github 官網上寫的清清楚楚,可直接進入看官網教程
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
解決git push/pull 每次都要輸入密碼、ssh-keygen