设置git的用户名和邮箱

设置git的用户名和邮箱

一直在使用自己搭建的github.io来保存博客,虽然更新比较慢,也算是记录了自己的学习过程。

今天在使用的时候意外发现自己在git上的contribution一直没有,鉴于自己时不时会提交博客记录,遂发现不对,难道是git出错了??明显是不可能的,经过查看,之前的大部分提交居然都是用实验室小伙伴的git帐号提交的。估计是之前小伙伴用我的电脑登录了他的git帐号吧,发现之后赶快改了一下git的帐号设置。

1
2
3
4
5
[~/path/to/repo]$ git config user.name "dongsihfu"
[~/path/to/repo]$ git config user.email 自己的git邮箱
This change will only affect future commits. Past commits will retain the username and address they were committed with.

设置好以后就用 :git config --list 命令查看。