<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Victor Bruce</title>
    <description>The latest articles on DEV Community by Victor Bruce (@victorbruce).</description>
    <link>https://dev.to/victorbruce</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F538255%2F3c4a827a-68ba-43a7-b56b-f0976669db18.jpeg</url>
      <title>DEV Community: Victor Bruce</title>
      <link>https://dev.to/victorbruce</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victorbruce"/>
    <language>en</language>
    <item>
      <title>A Simple Guide to Setting Up Absolute Imports in Vite + React (TypeScript)</title>
      <dc:creator>Victor Bruce</dc:creator>
      <pubDate>Fri, 16 Jan 2026 19:38:49 +0000</pubDate>
      <link>https://dev.to/victorbruce/a-simple-guide-to-setting-up-absolute-imports-in-vite-react-typescript-4j85</link>
      <guid>https://dev.to/victorbruce/a-simple-guide-to-setting-up-absolute-imports-in-vite-react-typescript-4j85</guid>
      <description>&lt;p&gt;Using relative imports can get messy in no time, especially in large, complex projects. Moving from relative paths like &lt;code&gt;../../../components/Button&lt;/code&gt; makes your code cleaner and easier to refactor.&lt;/p&gt;

&lt;p&gt;However, if you're working with Vite and TypeScript, simply updating your &lt;code&gt;tsconfig.json&lt;/code&gt; isn't enough. You have to ensure both the TypeScript compiler and the Vite build tool are on the same page. Here is the most direct way to set it up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Update your TypeScript Configuration
&lt;/h2&gt;

&lt;p&gt;In recent Vite templates, the &lt;code&gt;tsconfig.json&lt;/code&gt; file often acts as a base configuration that references other files. To follow this project structure correctly, you should place your path aliases inside &lt;code&gt;tsconfig.app.json&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Handling the "baseUrl" Deprecation
&lt;/h3&gt;

&lt;p&gt;A common issue developers face is the deprecation of &lt;code&gt;baseUrl&lt;/code&gt; in newer versions of TypeScript. You have two ways to handle this:&lt;/p&gt;

&lt;p&gt;Option A: The Modern Approach (Recommended) Remove &lt;code&gt;baseUrl&lt;/code&gt; entirely and use paths relative to the configuration file. Notice the &lt;code&gt;./&lt;/code&gt; prefix in the path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"composite"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Option B: The Legacy Workaround If you must use &lt;code&gt;baseUrl&lt;/code&gt;, you will need to silence the deprecation warning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ignoreDeprecations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;5.0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;depending&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;your&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;TS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;version&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"baseUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"src/*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Update your Vite Configuration
&lt;/h2&gt;

&lt;p&gt;While TypeScript now understands what &lt;code&gt;@/&lt;/code&gt; means for autocompletion and type checking, Vite still doesn't know how to resolve that alias during the actual build or dev process.&lt;/p&gt;

&lt;p&gt;Open your &lt;code&gt;vite.config.ts&lt;/code&gt; file and add the &lt;code&gt;resolve.alias&lt;/code&gt; property:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="c1"&gt;// other configurations&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/src&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why do we need both?
&lt;/h2&gt;

&lt;p&gt;It's helpful to remember the roles of these two files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;tsconfig.json&lt;/code&gt;: Tells VS Code and the TypeScript compiler how to find files so you get "Click to Definition" and no red squiggly lines.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;vite.config.ts&lt;/code&gt;: Tells the Bundler how to actually grab the code and put it in the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By syncing these two files, you get a seamless development experience with clean, absolute imports.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The End!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>vite</category>
      <category>absoluteimports</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Managing Multiple Git Identities: A Seamless Workflow for Personal and Work Accounts</title>
      <dc:creator>Victor Bruce</dc:creator>
      <pubDate>Fri, 16 Jan 2026 19:24:09 +0000</pubDate>
      <link>https://dev.to/victorbruce/managing-multiple-git-identities-a-seamless-workflow-for-personal-and-work-accounts-1kce</link>
      <guid>https://dev.to/victorbruce/managing-multiple-git-identities-a-seamless-workflow-for-personal-and-work-accounts-1kce</guid>
      <description>&lt;h3&gt;
  
  
  The Identity Crisis:
&lt;/h3&gt;

&lt;p&gt;We've all been there: pushing code using the wrong identity(e.g. using your personal email &lt;code&gt;coding_ninja1@gmail.com&lt;/code&gt; to commit work related code).&lt;/p&gt;

&lt;p&gt;Managing multiple Git identities on a single machine is a rite of passage for every developer. Whether you're balancing open-source work with a 9-to-5 or juggling different freelance clients, it's incredibly easy for your professional identities to start overlapping or lose track of which "hat" you're wearing at any given moment.&lt;/p&gt;

&lt;p&gt;In this post, I am going to walk you through a two-step evolution to solve this once and for all:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;The SSH Foundation&lt;/strong&gt;: We'll start by setting up unique SSH keys for different platforms(like GitHub vs. Bitbucket). While this secures your connection, it has a major limitation; you still have to manually remember to set your &lt;code&gt;user.email&lt;/code&gt; every single time you clone a new repo.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The Secret Sauce (Git Conditional Includes)&lt;/strong&gt;: I'll show you how to go beyond the manual setup. We will configure Git to be "&lt;strong&gt;context-aware&lt;/strong&gt;" so that your machine automatically swaps your name and email based on which folder you're working in.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By the end of this guide, you'll have a "&lt;strong&gt;set it and forget it&lt;/strong&gt;" system that ensures your professional work stays professional and your personal projects stay personal.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: The SSH Foundation
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;What is SSH?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SSH(Secure Shell) is a protocol that allows your computer to communicate securely with a server over an unsecured network. Instead of typing a username and password every time you push code, you use a &lt;strong&gt;key pair&lt;/strong&gt;: a &lt;strong&gt;public key&lt;/strong&gt; (which you share with &lt;strong&gt;Bitbucket/GitHub&lt;/strong&gt;) and a &lt;strong&gt;private key&lt;/strong&gt; (which stays locked on your machine).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting it up (Step-by-Step)&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Generate a New SSH key:
&lt;/h4&gt;

&lt;p&gt;Open your terminal and run the following command to create a key specifically for your work account and personal account(assuming you don't have one already created).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Work&lt;/strong&gt; (let's assume the organisation uses &lt;strong&gt;Bitbucket&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"work.email@acme.com"&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/id_ed25519_bitbucket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Personal&lt;/strong&gt; (let's assume you use &lt;strong&gt;Github&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"personal.email@gmail.com"&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/id_ed25519_github
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  When prompted for a passphrase, you can add one or leave it blank.&lt;/li&gt;
&lt;li&gt;  This creates a specific file named &lt;code&gt;id_ed25519_bitbucket&lt;/code&gt; and &lt;code&gt;id_ed25519_github&lt;/code&gt; .&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  Why &lt;code&gt;ed25519&lt;/code&gt;?
&lt;/h4&gt;

&lt;p&gt;You might notice we didn't use the traditional RSA algorithm. Here is why &lt;code&gt;ed25519&lt;/code&gt; is the modern gold standard:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Security:&lt;/strong&gt; It offers a higher security level than RSA with a much smaller key size.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Performance:&lt;/strong&gt; It is faster to generate and verify, making your Git commands feel snappier.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Collision Resistance:&lt;/strong&gt; It is mathematically designed to be more resistant to certain types of hacking attacks that older methods might be vulnerable to.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  2. Configure your SSH Config File
&lt;/h4&gt;

&lt;p&gt;Next we use the &lt;code&gt;~/.ssh/config&lt;/code&gt; file to act as a traffic controller. Whenever you interact with &lt;code&gt;bitbucket.org&lt;/code&gt; or &lt;code&gt;github.com&lt;/code&gt; --- Git will automatically use your &lt;strong&gt;work email key&lt;/strong&gt; or &lt;strong&gt;personal email key&lt;/strong&gt; respectively.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Open (or create) the config file: &lt;code&gt;nano ~/.ssh/config&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;  Add the following block:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal Account (GitHub)
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_github

# Work Account (Bitbucket)
Host bitbucket.org
  HostName bitbucket.org
  User git
  IdentityFile ~/.ssh/id_ed25519_bitbucket
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  3. Add Keys to the Platforms
&lt;/h4&gt;

&lt;p&gt;Now, the next step is to copy the "public" half of the keys generated to their respective websites:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Copy the public key: cat ~/.ssh/id_ed25519_github.pub
2. Log in to GitHub web interface
3. Go to Settings &amp;gt; SSH and GPG keys &amp;gt; New SSH Key
4. Paste the content you copied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bitbucket:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Copy the public key: cat ~/.ssh/id_ed25519_bitbucket.pub
2. Log in to Bitbucket web interface
3. Go to Personal Settings &amp;gt; SSH Keys &amp;gt; Add Key
4. Paste the content you copied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  4. Clone and Set Up Local Identity
&lt;/h4&gt;

&lt;p&gt;Before we dive into cloning your first work repo, it's important to understand how Git handles your identity. By default, Git is "lazy" --- &lt;strong&gt;it will use whatever you've set globally for every project on your machine&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Your "Default Base" (Global Config):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most developers prefer to set their personal account as the global default. This ensures that if you're hacking away on a side project or an open-source contribution, you don't have to do any extra setup.&lt;/p&gt;

&lt;p&gt;Run this once to set your "&lt;strong&gt;Default Base&lt;/strong&gt;":&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"personal.email@gmail.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now, every repository you create or clone will use this email &lt;strong&gt;unless you explicitly tell it otherwise.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Up Local Identity:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you transition to your professional workspace, you need to "&lt;strong&gt;override&lt;/strong&gt;" that global default. &lt;strong&gt;Since your machine is already using your personal email, you must manually sign your work for each corporate repository&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;1. Clone the Repository&lt;/p&gt;

&lt;p&gt;Using the SSH key we configured earlier, clone your work repo:&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@bitbucket.org:acme-corp/project-alpha.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;2. Set the local override&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;repo-name
git config user.name &lt;span class="s2"&gt;"Your Name"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"work.email@acme.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  The Manual Burden:
&lt;/h4&gt;

&lt;p&gt;This works perfectly, but there is a catch:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You have to remember to do this for every single work repo you clone.&lt;/strong&gt; If you forget that &lt;code&gt;git config&lt;/code&gt; command, you'll end up pushing professional code with your personal "default base" email.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This manual overhead is exactly why we use &lt;strong&gt;Conditional Includes&lt;/strong&gt; --- to make this switch happen automatically so you never have to think about it again.&lt;/p&gt;




&lt;h4&gt;
  
  
  Step 2: &lt;strong&gt;Git Conditional Includes&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Now your computer can 'talk' to both &lt;strong&gt;GitHub&lt;/strong&gt; and &lt;strong&gt;Bitbucket&lt;/strong&gt; without asking for a password. However, there is still one major problem; &lt;strong&gt;SSH handles the connection, but Git handles the name&lt;/strong&gt;. Meaning that, even if you use your &lt;strong&gt;work SSH key&lt;/strong&gt; to push to &lt;strong&gt;Bitbucket&lt;/strong&gt;, Git might still label your as &lt;code&gt;**personal_email@gmail.com**&lt;/code&gt; &lt;strong&gt;because of your global settings.&lt;/strong&gt; Let's fix that with the Secret Sauce*&lt;em&gt;(Git Conditional Includes)&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Goal&lt;/strong&gt;: Automate your identity so you never have to type &lt;code&gt;git config user.email&lt;/code&gt; again. This is a "&lt;strong&gt;set it and forget it&lt;/strong&gt;" strategy. By using &lt;strong&gt;Conditional Includes&lt;/strong&gt;, you tell Git: "&lt;em&gt;If I am working inside my Work folder, automatically swap my identity to my Acme email"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This prevents the common mistake of accidentally pushing a work commit with your personal email address.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Setting it up (Step-by-step)&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Organise Your Folders
&lt;/h4&gt;

&lt;p&gt;First, ensure your projects are separated by directory. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;~/Documents/Personal/&lt;/code&gt; : All your personal stuff or projects&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;~/Documents/Work/&lt;/code&gt; : All your work stuff or projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Create a "Work-Only" Config File
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;  Create a new file inside your &lt;strong&gt;Work&lt;/strong&gt; folder by running the command below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano ~/Documents/Work/.gitconfig-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  Paste the following into the &lt;code&gt;.gitconfig-work&lt;/code&gt; file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[user]&lt;/span&gt;
    &lt;span class="py"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;Your&lt;/span&gt; &lt;span class="err"&gt;Name&lt;/span&gt;
    &lt;span class="py"&gt;email&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="err"&gt;work.email@acme.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  Save and exit&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Link the "Work-Only" Config File in your Global Config
&lt;/h4&gt;

&lt;p&gt;Now, you need to tell your main Git configuration to "watch" your folders.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Open&lt;/strong&gt; your global config:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano ~/.gitconfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Add&lt;/strong&gt; this logic at the very bottom of the file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Default/Personal Identity
[user]
    name = Your Name
    email = personal.email@gmail.com

# Conditional Include: If the path starts with ~/Documents/Work/
[includeIf "gitdir:~/Documents/Work/"]
    path = ~/Documents/Work/.gitconfig-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  How it Works
&lt;/h4&gt;

&lt;p&gt;When you run a Git command Git checks your current directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  If you are in &lt;code&gt;~/Documents/Personal/repo&lt;/code&gt; , it sees your global email.&lt;/li&gt;
&lt;li&gt;  If you are in &lt;code&gt;~/Documents/Work/acme-project&lt;/code&gt; , the &lt;code&gt;includeIf&lt;/code&gt; trigger activates and &lt;strong&gt;overwrites&lt;/strong&gt; the global email with the one found in &lt;code&gt;.gitconfig-work&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Verifying The Setup
&lt;/h4&gt;

&lt;p&gt;To make sure it's working perfectly, navigate into a repo inside your &lt;strong&gt;Work folder&lt;/strong&gt; and run: &lt;code&gt;git config user.email&lt;/code&gt; . It should return &lt;code&gt;work.email@acme.com&lt;/code&gt; . If you move to a folder outside "Work" and run the same command, it should return your personal email.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;By combining &lt;strong&gt;SSH Config&lt;/strong&gt; (for secure access) and &lt;strong&gt;Conditional Includes&lt;/strong&gt; (for automated identity), you've built a professional-grade development environment. No more accidental commits, no more "unrecognised user" errors, and zero manual setup for new repos.&lt;/p&gt;

</description>
      <category>git</category>
      <category>ssh</category>
      <category>github</category>
      <category>bitbucket</category>
    </item>
  </channel>
</rss>
