I was logged in with my first User say A.
I signed out from that account and logged in with my User B. Now all my commits are being done with name A only.
All my preferences are set for User B. Even .gitignore file is set with User B. So what changes I need to do to get this working.
Actually the problem was with git settings file. It didn't change with new user.
So I followed following commands,
$ git config user.email "email@example.com" $ git config user.name "example name"
And also for globally i needed to change it so,
$ git config --global user.email "email@example.com" $ git config --global user.name "example name"
This resolved my problem.