关于git:git-账号密码过期

7次阅读

共计 837 个字符,预计需要花费 3 分钟才能阅读完成。

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
寄存目录如下:

scope location filename
system <git-install-root>\etc\,如:C:\Program Files\Git\etc\ gitconfig
global C:\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"
模式 存储时长 存储地位
不缓存【默认】
cache 15min 内存
store 永恒 磁盘
[其余]
正文完
 0