I have a work account and a personal github account. While my global git config is default set to use work account, sometimes I have to switch for a specific repository.
I do that by adding the following in config file in .git folder in the repo.
[user]
name = {{ Other account username }}
email = {{ Email }}
Maybe there is a better way but for now it works.