git push每次都需要输入帐号密码的解决方法

有时候git明明已经配置了用户名和密码,但在项目中,有时候pull和push的时候却每次都要提示输入用户名和密码,很浪费时间。

解决办法

在git bash中输入:

git config --global credential.helper store

执行完上面的git命令后,在命令行正常执行pull ,push,如果是在以上操作完之后第一次执行pull push,需要输入一次用户名密码,以后不再需要输入。

第一次向新的URL输入用户名密码之后会发现 .git-credentials中追加了类似 https://username:password@hello.com的内容

vim查看home路径中的.gitconfig,会在之前

[user]
name =**********

email=***********

的基础上多出

[credential]
helper = store

原文地址:https://www.cnblogs.com/liliuyu/p/14016350.html