0


git pull和push老是提示输入Git账号密码的解决方法

最近的项目在执行

  1. git pull/push

的时候,老是提示要输入账号和密码。输入正确之后,下次执行

  1. git pull/push

的时候还需要重新输入账号密码。

这应该是我不知道啥时候使用了错误的账号和密码,解决方法很简单:先

  1. cd

到根目录,执行以下命令:

git config --global credential.helper store

然后

  1. cd

到项目目录,执行

  1. git pull

命令,会提示输入账号密码。

输完这一次以后就不再需要

在多个项目,不同的git服务器,不同用户名时,对每个项目设置各自的local 配置。

  1. ## local
  2. git config --local credential.helper store
  3. git config --local user.email "email"
  4. git confgi --local user.name "name"
git配置级别

全局,保存在~/.gitconfig(windows),/etc/gitconfig(linux)

git config --global 配置内容

本地,保存在本地库/.git/config

git config --local 配置内容

查看GIT设置
  1. # 查看所有git设置
  2. git config -l
  3. # 查看git存储方式
  4. git config -l | find "credential"
  5. credential.helper=store
  6. # 查看不同级别的credential.helper
  7. # 全局
  8. D:\test> git config --global credential.helper
  9. manager
  10. # 本地
  11. D:\test> git config --local credential.helper
  12. store
标签: git

本文转载自: https://blog.csdn.net/ljh574649119/article/details/142988613
版权归原作者 luoluosheng07 所有, 如有侵权,请联系我们删除。

“git pull和push老是提示输入Git账号密码的解决方法”的评论:

还没有评论