使用git提交到github,每次都要输入用户名和密码的解决方法

使用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

 

原文:https://www.cnblogs.com/sky6862/p/7992736.html

posted @ 2019-07-31 15:57  低调码农哥!  阅读(1878)  评论(0编辑  收藏  举报