git账号密码过期了,在gitlab上批改后,本地还没进行同步时,连贯远端仓库,报了这个错

解决

  • 清空本地保留的用户名、明码(须要管理员身份)
git config --system --unset credential.helper
  • 此时重连会提醒输出用户名明码
  • 重新配置用户名明码
git config --global user.email "you@example.com"git config --global user.name "Your Name"
  • 发现每次都会要求输出用户名明码,设置将凭证存起来
git config --global credential.helper store

不想用命令行,也能够间接手动批改配置文件。

解析

git 配置文件

git 有多个范畴(scope)的的配置文件,范畴小的,覆盖范围大的
个别有system、global、local、worktree
寄存目录如下:

scopelocationfilename
system<git-install-root>\etc\,如:C:\Program Files\Git\etc\gitconfig
globalC:\Users\<username>\.gitconfig
local<git-repo>.git\config
worktree同上config.worktree

查找Git配置文件

记不住配置了哪些scope,能够应用以下命令查看所有的git配置文件

git config --list --show-origin

具体地列出配置内容和配置文件门路

与上面命令不同的是,上面命令只显示配置信息,不显示门路

git config --list

git 凭证存储

git 如果是通过http拜访近程仓库,须要输出用户名和明码,此时,如果不将凭证存储,则须要一遍一遍地输出用户名明码。

git config credential.helper "$helper $options"
模式存储时长存储地位
不缓存【默认】----
cache15min内存
store永恒磁盘
[其余]----