• git修改 config 配置用户名和邮箱


    1.git 查看全部配置

    先查看本地的 config 配置文件内容

    $ git config --list
    ...
    init.defaultbranch=master
    user.name=wenxxx
    user.email=wenxxxg@xxx.com.cn
    ...
    init.defaultbranch=master
    user.name=wenxxx
    user.email=wenxxx@xxx.com.cn
    core.repositoryformatversion=0
    core.filemode=false
    core.bare=false
    core.logallrefupdates=true
    core.symlinks=false
    core.ignorecase=true
    remote.origin.url=git@gitee.com:xxxxx/test.git
    remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
    branch.dev.remote=origin
    branch.dev.merge=refs/heads/dev
    

    这时候看到 user.name 和 user.eamil 并不是自己的

    2.删除全局 config 配置

    使用以下命令删除其中一个配置项

    git config --global --unset configname
    

    删除后,再去查看就没有了

    $ git config --global --unset user.name
    $ git config --global --unset user.email
    $ git config --list
    

    3.添加 config 配置

    再把自己的 git 账号和邮箱添加到 config 配置

    git config --global user.name "coder"
    git config --global user.email coder@example.com
    

    完成以上就可以修改用户名。

    4.config 增删改查操作

    新增

    git config --global --add configname configvalue
    

    删除

    git config --global --unset configname
    

    修改

    git config --global configname configvalue
    

    查询

    git config --global configname
    

    查询全部

    git config --list
    
  • 相关阅读:
    Java基础----ArrayList中的clear方法以及ArrayList对象
    LeetCode152:乘积最大子数组
    LeetCode18:四数之和
    LeetCode120 :三角形最小路径和
    LeetCode406:根据身高重建队列
    LeetCode347:前 K 个高频元素
    LeetCode-146:LRU缓存机制
    LeetCode-17:电话号码的字母组合
    LeetCode
    任务调度冲突
  • 原文地址:https://www.cnblogs.com/davis12/p/14954765.html
Copyright © 2020-2023  润新知