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
- Go to your repo folder &
show hidden folders
- Go to
.git
hidden folder and openconfig
file - 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
Top comments (0)