DEV Community

loading...
Cover image for Change Git user for a specific repo

Change Git user for a specific repo

Deshan Madurajith
Software Engineer. Help small tech startups
・1 min read

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

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"

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

Discussion (0)