Skip to content

Instantly share code, notes, and snippets.

@abinavseelan
Last active October 17, 2018 13:29
Show Gist options
  • Save abinavseelan/706865be42a9d907f918a142f929ed24 to your computer and use it in GitHub Desktop.
Save abinavseelan/706865be42a9d907f918a142f929ed24 to your computer and use it in GitHub Desktop.
Different gitconfigs for different folders
/*
If you have seperate github accounts for personal use and work, but use the same laptop.
Taken from this StackOverflow answer: https://stackoverflow.com/a/43884702
*/
/*
Have two folders, ~/company is going to house all your company repos and
~/personal is going to house all your personal projects
*/
// In ~/.gitconfig
[includeIf "gitdir:~/company/"]
path = .gitconfig-company
[includeIf "gitdir:~/personal/"]
path = .gitconfig-personal
// In ~/.gitconfig-company
[user]
name = John Doe
email = john.doe@company.com
// In ~/.gitconfig-personal
[user]
name = John Doe
email = john.doe@gmail.com
For handling multiple ssh keys: https://medium.freecodecamp.org/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment