It's possible to use --local and --global .gitconfig's.
Sometimes you need something in between, i.e. your workspace uses GitLab on a private domain and you use GitHub for your own purposes.
Since 2.13.0 possible to split logic for different domains.
You need a file for your GitHub (.gitconfig-github)
[user] name = username email = email@example.com Another file for your GitLab (.gitconfig-github)
[url "git@gitlab.yourdomain.com:"] insteadOf = https://gitlab.yourdomain.com/ [user] name = John Johnson email = johnjohnson@yourdomain.com Finally, split the configs via .gitconfig
[core] excludesfile = /Users/username/.gitignore [includeIf "gitdir:$GOPATH/src/github.com/"] path = /Users/username/.gitconfig-github [includeIf "gitdir:$GOPATH/src/gitlab.yourdomain.com/"] path = /Users/username/.gitconfig-gitlab
Top comments (0)