Artem Piskun
Posted on May 6, 2020
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
💖 💪 🙅 🚩
Artem Piskun
Posted on May 6, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
undefined Lesson 4: "Integrating Mattermost with Development Tools: A Practical Guide"
November 28, 2024