DEV Community

Discussion on: Setting up multiple GitHub accounts, the nicer way

Collapse
 
rodrigosaling profile image
Rodrigo Saling

Lot of steps to be be able to add a comment! Anyway, if you read this post and git is not using the correct information, maybe that's because you can't explicit set configurations after the [includeIf]. You must include a file instead.

Only after reading the git-config documentation, and noticing that they talk a lot about a path property, I decided to move the sshCommand to another file. And then it finally worked correctly. What I currently have:

[includeIf "gitdir:~/path/to/work/repository/"]
    path = ./.gitconfig-work

[includeIf "gitdir:~/path/to/personal/repository/"]
    path = ./.gitconfig-personal
Enter fullscreen mode Exit fullscreen mode

Arnelle, thanks for this post. It's way better then using custom hosts!