0

Lets say that I've different projects with different credentials and configurations specific to each one of them.

I'm using --global to set the configurations for the project I use the most but, for all the other projects I need to manually get into the repositories and update those individual configurations for email, name, GPG signatures and so on.

I've written some scripts to automate this configuration process for each individual configuration set, but now I need to remember to run those scripts every time I clone a new repository. And it gets even worse if those repositories have submodules in them.

Is there a way to solve this problem and automatically run the correct script when I clone a repository? I was thinking about linking it with the Organization name in the URL of the repository, but I couldn't quite get the idea on how to do it.

Daniel Schröder
  • 547
  • 4
  • 18
  • 5
    Separate projects by directories and use [conditional includes](https://stackoverflow.com/a/43654115/7976758) Found in https://stackoverflow.com/search?q=%5Bgit%5D+multiple+email – phd Jul 31 '22 at 17:22
  • Nice. This solves my problem. I was looking for configs (.gitconfig) as a whole in my search and didn't find any relevant results. Narrowing it down to email and it seems like it's a pretty common problem. – Daniel Schröder Jul 31 '22 at 21:36
  • 1
    Please be warned that `includeIf "gitdir:…"` works only in **repositories** under named directory but not in the very directory (if it's not a repo itself). See https://stackoverflow.com/q/71473679/7976758 – phd Jul 31 '22 at 23:33

0 Answers0