当前位置:   article > 正文

Git配置、缓存用户名密码和清除缓存_git config --global credential.helper store

git config --global credential.helper store

说明:此处为什么放在开头,因为很多人都不仔细看下面内容,这一句是废话。

        只要是加-- global的都是设置全局的,建议不要这样设置。下面的所有的操作都是编辑的 .git/config的内容,也可以找到这个文件,直接添加内容。

1.配置用户名和邮箱,分为全局和项目两种:

        1)此处内容为全局设置用户名和邮箱 

  1. git config --global user.name "username"
  2. git config --global user.email "useremail@qq.com"

        2)  此处为单个项目设置用户名和密码

  1. git config user.name "username"
  2. git config user.email "useremail@qq.com"

2.清除配置中纪录的用户名和密码,下次提交代码时会让重新输入账号密码

git config --system --unset credential.helper

3.执行下面命令之后,再次pull或push时会缓存输入的用户名和密码

  1. git config --global credential.helper store #全局
  2. git config credential.helper store #单个项目

4.清除git缓存中的用户名的密码

  1. git credential-manager uninstall
  2. #如果电脑是macos提示 git: 'credential-wincred' is not a git command. See 'git --help'
  3. #第一步:git config --unset-all credential.helper
  4. #第二步:git config --global credential.helper osxkeychain
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/207890
推荐阅读
相关标签
  

闽ICP备14008679号