DEV Community

Cover image for Git user config per path
João Vitor
João Vitor

Posted on

2 2

Git user config per path

TIL git config core.sshCommand

TIL here that git provides a config for core.sshCommand.

I was already splitting my personal and work git user configuration by path with this setting in my ~/.gitconfig.

So adding the block below simplified my .ssh/config and my cloning/pushing.

[core]
       sshCommand = "ssh -i ~/.ssh/id_ed25519_personal -F /dev/null"
Enter fullscreen mode Exit fullscreen mode

~/.gitconfig

[include]
    path = ~/dotfiles/gituser_work.include
[includeIf "gitdir/i:~/dotfiles/"]
    path = ~/dotfiles/gituser_personal.include
Enter fullscreen mode Exit fullscreen mode

gituser_work.include

[user]
       name = Your Full Name
       email = your@work-email.com
Enter fullscreen mode Exit fullscreen mode

gituser_personal.include

[user]
       name = Your Full Name
       email = your@personal-email.com

[core]
       sshCommand = "ssh -i ~/.ssh/id_ed25519_personal -F /dev/null"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more