問題背景
在提交自己的 Github 代碼,(盡管有重新設置了 自己的SSH),但是提交結果卻顯示自己GitHub提交的,並非公司郵箱:
驗證當前本地屬性
怎么知道本地有設置?
git config --local --list
怎么設置本地屬性?
git config user.name
git config user.email
解決方法
法一:使用命令修改git的用戶名和提交的郵箱
1)修改全局
如果你要修改當前全局的用戶名和郵箱時,需要在上面的兩條命令中添加一個參數,--global,代表的是全局。
git config --global user.name 你的目標用戶名;
git config --global user.email 你的目標郵箱名;
2)修改當前的 project
git 修改當前的project的用戶名的命令為:
git config user.name 你的目標用戶名;
git 修改當前的project提交郵箱的命令為:
git config user.email 你的目標郵箱名;
重新提交
現在就可以顯示本人提交了。
【Reference】