git使用教程10-修改 config 配置用戶名和郵箱


前言

當我們使用 git 提交代碼的時候,發現賬號和郵箱是之前同事配置的,這時候需要改成自己的賬號,那么如何修改 git 的 config 配置文件?
就算卸載 git 重新安裝也沒用,之前的配置文件還是在的。

git 查看全部配置

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

git config --list

這時候看到 user.name 和 user.eamil 並不是自己的

刪除全局 config 配置

使用以下命令刪除其中一個配置項

git config --global --unset configname

刪除后,再去查看就沒有了

添加 config 配置

再把自己的 git 賬號和郵箱添加到 config 配置

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

這樣我們的配置就改回來了

config 增刪改查操作

新增

git config --global --add configname configvalue

刪除

git config --global --unset configname

修改

git config --global configname configvalue

查詢

git config --global configname

查詢全部

git config --list


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM