Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set git credentials based on folder

Is it possible to have a folder that contains multiple repos use one set of credentials and have another folder user a different account? For example I would like to have one folder on my mac for work repos and one folder for personal and have the git username and password automatically switch based on which folder I am in.

like image 305
cbutler Avatar asked May 31 '18 07:05

cbutler


1 Answers

Configuring git config for specific folders is too easy. You can achieve that using just two git commands. Just enter the directory you want git account info to be changed for and do this:

git config --local user.email "[email protected]"

git config --local user.name "yourName"

I think this will help.

Cheers!

like image 111
Vikas Yadav Avatar answered Sep 18 '22 22:09

Vikas Yadav