<?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: Madhan Gannarapu</title>
    <description>The latest articles on DEV Community by Madhan Gannarapu (@madhan_gannarapu).</description>
    <link>https://dev.to/madhan_gannarapu</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%2F905389%2Fd704f253-00ee-4c05-8b65-30997c7176a5.jpeg</url>
      <title>DEV Community: Madhan Gannarapu</title>
      <link>https://dev.to/madhan_gannarapu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madhan_gannarapu"/>
    <language>en</language>
    <item>
      <title>What Is CORS and Why Is It Breaking My API Requests?</title>
      <dc:creator>Madhan Gannarapu</dc:creator>
      <pubDate>Fri, 01 Aug 2025 11:32:48 +0000</pubDate>
      <link>https://dev.to/madhan_gannarapu/what-is-cors-and-why-is-it-breaking-my-api-requests-38n4</link>
      <guid>https://dev.to/madhan_gannarapu/what-is-cors-and-why-is-it-breaking-my-api-requests-38n4</guid>
      <description>&lt;p&gt;If you’ve ever built a web app that talks to a backend API, you’ve probably run into this scary message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ “Access to fetch at ‘some-api.com’ from origin ‘your-site.com’
has been blocked by CORS policy...”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sounds confusing? Don’t worry — this article will explain what CORS is, why it exists, and how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem: Different Origins
&lt;/h2&gt;

&lt;p&gt;Let’s say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your frontend is hosted at: &lt;a href="https://mycoolapp.com" rel="noopener noreferrer"&gt;https://mycoolapp.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Your backend API lives at: &lt;a href="https://api.mycoolapp.com" rel="noopener noreferrer"&gt;https://api.mycoolapp.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though they look similar, the browser sees them as different places, called origins.&lt;/p&gt;

&lt;p&gt;An origin is made up of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;Origin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;protocol&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If any of these are different, the browser treats it as a cross-origin request&lt;/p&gt;

&lt;p&gt;And that’s when CORS steps in.&lt;/p&gt;

&lt;h2&gt;
  
  
  So What is CORS?
&lt;/h2&gt;

&lt;p&gt;CORS stands for Cross-Origin Resource Sharing.&lt;/p&gt;

&lt;p&gt;It’s a security rule built into all modern browsers that says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I’ll only let your website fetch data from another origin if that origin allows it.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That means — even if your API is working fine, the browser can still block your request unless the API sends back the right permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does the Browser Do This?
&lt;/h2&gt;

&lt;p&gt;It’s there to protect users.&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You’re logged into your bank.&lt;/li&gt;
&lt;li&gt;You visit a shady site.&lt;/li&gt;
&lt;li&gt;That site secretly tries to make a request to your bank using your login session.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without CORS, the shady site could potentially succeed.&lt;/p&gt;

&lt;p&gt;So browsers add a safety check:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“You can’t send requests to other websites unless they clearly say it’s okay”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  When Do CORS Errors Happen?
&lt;/h2&gt;

&lt;p&gt;CORS errors usually happen when your website tries to talk to another origin. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✅ Your site: https://example.com

❌ Tries to call:
- http://example.com        (different protocol)
- https://api.example.com   (different subdomain)
- https://backend.com       (different domain)
- https://example.com:8080  (different port)

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

&lt;/div&gt;



&lt;p&gt;Other reasons CORS might fail:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The backend doesn’t return the correct CORS headers&lt;/li&gt;
&lt;li&gt;You’re sending Authorization headers or cookies&lt;/li&gt;
&lt;li&gt;You’re using PUT, DELETE, or custom headers — which triggers a preflight request&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the browser doesn’t get permission, it blocks the request.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s a Preflight Request?
&lt;/h2&gt;

&lt;p&gt;A preflight request is like asking for permission before doing something sensitive.&lt;br&gt;
Let’s say your frontend wants to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the PUT method&lt;/li&gt;
&lt;li&gt;Send application/json data&lt;/li&gt;
&lt;li&gt;Include a token in headers
The browser says:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;“Hold on! Let me check with the server first.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So it sends an hidden OPTIONS request - this is called “preflight.”&lt;br&gt;
If the server replies properly, your request goes through ✅&lt;br&gt;
If not, the browser blocks it 💥&lt;/p&gt;
&lt;h2&gt;
  
  
  How the OPTIONS Request Works
&lt;/h2&gt;

&lt;p&gt;Browser sends:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;OPTIONS /api/user HTTP/1.1  
Origin: https://mycoolapp.com  
Access-Control-Request-Method: PUT  
Access-Control-Request-Headers: Content-Type, Authorization  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Server must respond:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Access-Control-Allow-Origin: https://mycoolapp.com  
Access-Control-Allow-Methods: GET, POST, PUT, DELETE  
Access-Control-Allow-Headers: Content-Type, Authorization  
Access-Control-Allow-Credentials: true  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the server doesn’t send these headers, the request will be blocked.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Fix CORS
&lt;/h2&gt;

&lt;p&gt;If you control the backend, here’s what you need to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow your frontend’s origin&lt;/li&gt;
&lt;li&gt;Handle the OPTIONS method&lt;/li&gt;
&lt;li&gt;Allow necessary headers and methods&lt;/li&gt;
&lt;li&gt;If you’re using cookies or auth tokens, set Access-Control-Allow-Credentials: true&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Fixing CORS in Node.js (Express)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cors&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://mycoolapp.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// allow your frontend&lt;/span&gt;
  &lt;span class="na"&gt;methods&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;GET&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;POST&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;PUT&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;DELETE&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;OPTIONS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                        &lt;span class="c1"&gt;// allow cookies/tokens&lt;/span&gt;
  &lt;span class="na"&gt;allowedHeaders&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;Content-Type&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;Authorization&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;options&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="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// Handle preflight&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Quick Troubleshooting Checklist
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✅ CORS Debugging Checklist

✅ Check                                  | Example
------------------------------------------|---------------------------------------------------
Is the origin allowed?                    | Access-Control-Allow-Origin: https://mycoolapp.com
Are custom headers allowed?               | Authorization, X-Custom-Header
Is the preflight request handled?         | Allow OPTIONS requests
Are credentials (cookies/tokens) enabled? | Access-Control-Allow-Credentials: true
Are you using * with credentials?         | ❌ Not allowed. Use exact origin instead
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>api</category>
      <category>websecurity</category>
      <category>cors</category>
      <category>devchallenge</category>
    </item>
    <item>
      <title>Managing Multiple Git Accounts on One Machine(Mac/Linux)</title>
      <dc:creator>Madhan Gannarapu</dc:creator>
      <pubDate>Fri, 04 Jul 2025 08:47:08 +0000</pubDate>
      <link>https://dev.to/madhan_gannarapu/managing-multiple-git-accounts-on-one-machine-83l</link>
      <guid>https://dev.to/madhan_gannarapu/managing-multiple-git-accounts-on-one-machine-83l</guid>
      <description>&lt;p&gt;How to set up and manage personal and work Git accounts on your local machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Introduction
&lt;/h2&gt;

&lt;p&gt;Many developers work with both personal and work GitHub accounts. Here's how to manage them on a Mac...&lt;/p&gt;

&lt;h2&gt;
  
  
  What You’ll Learn
&lt;/h2&gt;

&lt;p&gt;✅ Use SSH to separate identities&lt;br&gt;
✅ Automatically apply correct Git user config based on folder&lt;br&gt;
✅ Clean directory structure&lt;/p&gt;
&lt;h2&gt;
  
  
  📁 Directory Setup
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/
├── .ssh/
│   ├── work/
│   │   ├── id_ed25519_work
│   │   ├── id_ed25519_work.pub
│   ├── personal/
│   │   ├── id_ed25519_personal
│   │   ├── id_ed25519_personal.pub
│   └── config               # SSH config file
├── .gitconfig
├── .gitconfig-work          # Workspace-specific Git config
├── .gitconfig-personal      # Personal Git config
├── work/                    # All workspace (work) repositories
└── personal/                # All personal repositories
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Set Up Personal and Work
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir personal work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;personal&lt;/code&gt;: Use this folder for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your own apps, portfolios&lt;/li&gt;
&lt;li&gt;Open source contributions&lt;/li&gt;
&lt;li&gt;Learning new tech, coding experiments&lt;/li&gt;
&lt;li&gt;Resume or portfolio projects&lt;/li&gt;
&lt;li&gt;Hackathons or fun builds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;work&lt;/code&gt;: Use this folder for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;company apps/repos&lt;/li&gt;
&lt;li&gt;poc apps&lt;/li&gt;
&lt;li&gt;Anything related to employment&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Generate SSH Keys for Each Git Account
&lt;/h2&gt;

&lt;p&gt;Generate a unique SSH key for each GitHub or GitLab account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal
ssh-keygen -t ed25519 -C "your-email@personal.com" -f ~/.ssh/personal/id_ed25519_personal

# Work
ssh-keygen -t ed25519 -C "your-email@company.com" -f ~/.ssh/work/id_ed25519_work

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

&lt;/div&gt;



&lt;p&gt;Now Add the SSH keys to the ssh-agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal
ssh-add ~/.ssh/personal/id_ed25519_personal

# Work
ssh-add ~/.ssh/work/id_ed25519_work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add SSH Keys to Your GitHub Accounts (Company &amp;amp; Personal)
&lt;/h2&gt;

&lt;p&gt;Once you've generated the SSH keys, you need to add the public keys to your respective GitHub accounts so they can recognize and authorize your machine&lt;br&gt;
To view the SSH keys in terminal run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal
cat ~/.ssh/personal/id_ed25519_personal.pub

# work
cat ~/.ssh/work/id_ed25519_work.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure the SSH Config File
&lt;/h2&gt;

&lt;p&gt;Create or update your ~/.ssh/config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch ~/.ssh/config
open ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal
Host github.com-personal
  HostName github.com
  User git
  IdentityFile ~/.ssh/personal/id_ed25519_personal

# Work
Host github.com-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/work/id_ed25519_work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;github.com-personal&lt;/code&gt; or &lt;code&gt;github.com-work&lt;/code&gt; as the remote URL host.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification SSH with GitHub accounts
&lt;/h2&gt;

&lt;p&gt;To verify SSH works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -T git@github-work
ssh -T git@github-personal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expect messages like: “Hi ! You've successfully authenticated...”&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure the Global&lt;code&gt;.gitconfig&lt;/code&gt; File
&lt;/h2&gt;

&lt;p&gt;Create two custom Git configs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal Git config
touch ~/.gitconfig-personal

# Work Git config
touch ~/.gitconfig-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open and fill them like this:&lt;br&gt;
~/.gitconfig-personal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[user]
  name = Madhan Gannarapu
  email = your-email@personal.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;~/.gitconfig-work&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[user]
  name = Madhan Gannarapu
  email = your-email@company.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Use Conditional Includes in Global &lt;code&gt;.gitconfig&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Create or update your &lt;code&gt;~/.ssh/config&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch ~/.ssh/config
open ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[user]
  name = Default Madhan
  email = default@example.com

[includeIf "gitdir:~/work/**"]
  path = ~/.gitconfig-work

[includeIf "gitdir:~/personal/**"]
  path = ~/.gitconfig-personal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This config tells Git to automatically use different identity files depending on which directory the repo is in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clone Repos with Correct SSH Host
&lt;/h2&gt;

&lt;p&gt;Use the matching host from your &lt;code&gt;~/.ssh/config&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Personal
git clone git@github.com-personal:username/repo.git ~/Projects/personal/repo

# Work
git clone git@github.com-work:company/repo.git ~/Projects/work/repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>git</category>
      <category>github</category>
      <category>productivity</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
