Skip Navigation
cynkra


Maintaining multiple identities with Git

From the Blog
DevOps

Author

Kirill Müller

Published

Reading time

2 min

Kirill Müller / 2 min read

When committing to a Git repository related to my consulting work, I must use my company e-mail address, kirill@cynkra.com. Not so much for my open-source work – for this, I prefer to use other e-mail addresses, like krlmlr+r@mailbox.org . (For example, Travis CI sends notification e-mails to the committer’s e-mail address, and I have set up filtering for that other address.)

Illustration Photo by Carson Arias

Having to configure the e-mail address for each repository separately eventually gets annoying. Instead, I’d rather have all repos within a specific subdirectory use particular e-mail address.

All my Git repos live in ~/git. Subdirectories R and cynkra, contain R packages and repos related to consulting, respectively. To achieve the desired setup, I edit my ~/.gitconfig with the following entry:

[includeIf "gitdir:git/**"]
    path = git/.gitconfig

This ensures that all repos in the git directory use the git/.gitconfig file in addition to the main configuration. That file contains the following:

[includeIf "gitdir:R/**"]
    path = R/.gitconfig
[includeIf "gitdir:cynkra/**"]
    path = cynkra/.gitconfig

Finally, in ~/git/R/.gitconfig and ~/git/cynkra/.gitconfig, I configure the e-mail addresses I want to use for all repos pertaining to R and cynkra, respectively.

[user]
    email = ...

I verify the setup with git config -l | grep user. Indeed, cynkra repos use the cynkra e-mail address. Voilà!

The above approach requires a recent-ish version of git- version 2.14 or later should suffice. Read more about conditional includes.

Written by


Read next

Patrick Schratz /

EFS vs. NFS for RStudio on Kubernetes (AWS): Configuration and considerations

DevOps|Posit|performance

As a consulting company with a strong focus on R and Posit (formerly RStudio) products, we have gathered quite a bit of experience in configuration and deployment of Workbench and Connect products in the cloud. We would like to share some of these insights and shine some light on the file system debate around these applications.

Patrick Schratz /

Accessing Google's API via OAuth2

DevOps

At cynkra we recently aimed to automate more parts of our internal toolstack. Google Workspace offers a comprehensive REST API which can be used for automation purposes. When interacting with an API, authentication is usually required.

Cosima Meyer, Patrick Schratz /

Celebrating one-year anniversary as RStudio Full Service Certified Partner

Posit|DevOps

cynkra celebrates its first anniversary as an RStudio Full Service Certified Partner! Every day, we help our clients set up professional IT infrastructures using RStudio products and license compositions suited to their individual needs.