使用git提交文件到github,每次都要輸入用戶名和密碼,操作起來很麻煩,以下方法可解決,記錄以下。
原因:在clone 項目的時候,使用了 https方式,而不是ssh方式。
默認clone 方式是:https
解決方法:
到本地項目文件夾子,打開git bash
1.查看clone 地址:
git remote -v
2.移除https的方式,換成 ssh方式
git remote rm origin
3.添加新的git方式:ssh方式,ssh方式地址的話,在github上,切換到ssh方式,然后復制地址。
git remote add origin git地址
4.查看push方式是否修改成功:
git remote -v
5.重新push(提交一下)
git push origin maste