因?yàn)楣ぷ鞯捻?xiàng)目和自己的項(xiàng)目需要來(lái)回切換调榄,所以賬號(hào)問(wèn)題就需要解決。
我選擇的方法比較簡(jiǎn)單粗暴呵扛,可以酌情參考每庆。
cd ~/you project # 進(jìn)入項(xiàng)目文件夾
git init # 初始化項(xiàng)目(如果已經(jīng)是git目錄,就不需要)
git config user.name "your_name" # 重新設(shè)置用戶名
git config user.email "your_email" # 重新設(shè)置郵箱
也就是進(jìn)入到git項(xiàng)目相對(duì)根目錄下今穿,然后執(zhí)行g(shù)it config設(shè)置記錄缤灵。
這時(shí)候打開項(xiàng)目中的.git文件夾,查看config文件會(huì)發(fā)現(xiàn)多了兩行:
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = your_name
email = your_mail
下一次提交的時(shí)候蓝晒,就優(yōu)先使用項(xiàng)目文件中的git配置信息了腮出。如果有必要可以執(zhí)行取消全局設(shè)置的命令:
git config --global --unset user.name
git config --global --unset user.email