DEV Community

Cover image for Change Git user for a specific repo
Deshan Madurajith
Deshan Madurajith

Posted on

Change Git user for a specific repo

Sometimes you may work on multiple projects using multiple git users. Your personal project with your personal GitHub and office GitHub with your business email. You may need to commit like someone else 🤫. There are two options to change git author of your repository.

1. Change without Terminal

  1. Go to your repo folder & show hidden folders
  2. Go to .git hidden folder and open config file Alt Text
  3. Add/replace the following block in the config file
[user]
    name = deshan
    email = deshan [at] dev.to
Enter fullscreen mode Exit fullscreen mode

Now you can commit a new change and check author information.

2. Change with Terminal

Open the terminal and go to the repository. Enter the following command

git config user.email "deshan@dev.to"
git config user.name "deshan"
Enter fullscreen mode Exit fullscreen mode

If you want to change the author for previous commits, follow this replace-accidentally-committed-git-author-information-from-git-history

Top comments (0)