Git: Managing Multiple Accounts
dev.to·2d·
Discuss: DEV
🌿Git Workflows
Preview
Report Post

Every developer who has ever dealt with a personal project, a job, and perhaps a freelance project on the same machine knows the pain of accidentally git commit with the wrong email. Git allows you to manage multiple accounts using only native features of the tool.

Here I will show how I configured my Linux and Windows environment, how I keep my personal and work projects organized, making Git automatically use the corresponding accounts and the correct SSH key for each project. No more need to use git config --local user.email ... with each new clone!

The configuration uses two features of Git and SSH:

Multiple SSH Keys: A unique key for each Git provider (GitHub, GitLab, etc.) for authentication. 1.

Git Conditional Inclusion: The includeIf directive in your …

Similar Posts

Loading similar posts...