<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Niran Maharjan]]></title><description><![CDATA[Niran Maharjan]]></description><link>https://niranx.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 08:30:33 GMT</lastBuildDate><atom:link href="https://niranx.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Unleash Your Workloads: Secure AWS Access from Anywhere with IAM Roles Anywhere]]></title><description><![CDATA[In today's hybrid cloud landscape, securely connecting your on-premises servers, edge devices, and containerized applications to AWS services is a critical challenge. Hardcoding AWS access keys is a security nightmare, leading to potential breaches a...]]></description><link>https://niranx.dev/secure-aws-access-with-iam-roles-anywhere</link><guid isPermaLink="true">https://niranx.dev/secure-aws-access-with-iam-roles-anywhere</guid><category><![CDATA[AWS]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Hybrid Cloud]]></category><dc:creator><![CDATA[Niran Maharjan]]></dc:creator><pubDate>Thu, 24 Jul 2025 18:15:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/WELyMatW3mw/upload/c517e11a33507393e00eda804885a4b4.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In today's hybrid cloud landscape, securely connecting your on-premises servers, edge devices, and containerized applications to AWS services is a critical challenge. Hardcoding AWS access keys is a security nightmare, leading to potential breaches and compliance headaches. Enter <strong>AWS IAM Roles Anywhere</strong>, a powerful service that empowers your workloads outside of AWS to seamlessly and securely access your cloud resources using the trust of X.509 certificates.</p>
<p>This post will guide you through the process of setting up AWS IAM Roles Anywhere, from generating your own Certificate Authority (CA) to configuring your local environment for secure access.</p>
<h3 id="heading-the-power-of-trust-x509-certificates">The Power of Trust: X.509 Certificates</h3>
<p>At the heart of IAM Roles Anywhere lies the concept of trust established through X.509 certificates. Instead of long-lived access keys, your external workloads present a short-lived credential issued based on a certificate signed by a trusted Certificate Authority (CA). This significantly enhances your security posture by:</p>
<ul>
<li><p><strong>Eliminating static credentials:</strong> No more hardcoded access keys lying around.</p>
</li>
<li><p><strong>Leveraging short-term credentials:</strong> Credentials automatically expire, reducing the impact of potential compromise.</p>
</li>
<li><p><strong>Centralized trust management:</strong> Your CA becomes the single source of truth for authenticating external workloads.</p>
</li>
</ul>
<h3 id="heading-step-1-forge-your-trust-anchor-the-private-root-ca">Step 1: Forge Your Trust Anchor – The Private Root CA</h3>
<p>The first crucial step is to generate your own private Root CA. This Root CA acts as the ultimate trust anchor within AWS IAM Roles Anywhere. We'll use OpenSSL for this, a powerful open-source toolkit for managing SSL/TLS certificates.</p>
<p><strong>Prerequisites:</strong></p>
<ul>
<li><p>OpenSSL installed on your system.</p>
</li>
<li><p>A working directory, commonly <code>~/.aws</code>, to store your certificate files.</p>
</li>
<li><p>An <code>openssl.cnf</code> file (we'll call it <code>v3.ext</code> for this example) with basic CA constraints and identity attributes.</p>
</li>
</ul>
<p><strong>Creating Your</strong> <code>v3.ext</code> OpenSSL Configuration File:</p>
<p>Create a file named <code>v3.ext</code> in your <code>~/.aws</code> directory with the following content. <strong>Remember to replace the placeholder values for Country, State, City, Organization, Organizational Unit, Commo with your actual details.</strong> Leave <code>commonName</code> and <code>emailAddress</code> blank.</p>
<pre><code class="lang-ini"><span class="hljs-section">[ req ]</span>
<span class="hljs-attr">default_bits</span>        = <span class="hljs-number">2048</span>
<span class="hljs-attr">distinguished_name</span>  = req_distinguished_name
<span class="hljs-attr">x509_extensions</span>     = v3_ca

<span class="hljs-section">[ req_distinguished_name ]</span>
<span class="hljs-attr">countryName</span>                     = Country Name (<span class="hljs-number">2</span> letter code)
<span class="hljs-attr">countryName_default</span>             = US
<span class="hljs-attr">countryName_min</span>                 = <span class="hljs-number">2</span>
<span class="hljs-attr">countryName_max</span>                 = <span class="hljs-number">2</span>

<span class="hljs-attr">stateOrProvinceName</span>             = State or Province Name (full name)
<span class="hljs-attr">stateOrProvinceName_default</span>     = California

<span class="hljs-attr">localityName</span>                    = Locality Name (eg, city)
<span class="hljs-attr">localityName_default</span>            = San Francisco

<span class="hljs-attr">0.organizationName</span>              = Organization Name (eg, company)
<span class="hljs-attr">0.organizationName_default</span>      = ABC Inc.

<span class="hljs-attr">organizationalUnitName</span>          = Organizational Unit Name (eg, section)
<span class="hljs-attr">organizationalUnitName_default</span>  = DevOps

<span class="hljs-attr">commonName</span>                      = Common Name (e.g. server FQDN or YOUR name)
<span class="hljs-attr">commonName_max</span>                  = <span class="hljs-number">64</span>

<span class="hljs-attr">emailAddress</span>                    = Email Address
<span class="hljs-attr">emailAddress_max</span>                = <span class="hljs-number">64</span>

<span class="hljs-comment"># --------------------------------------------------------------------</span>
<span class="hljs-comment"># For creating a root or intermediate CA certificate</span>
<span class="hljs-section">[ v3_ca ]</span>
<span class="hljs-attr">subjectKeyIdentifier</span>    = hash
<span class="hljs-attr">authorityKeyIdentifier</span>  = keyid:always,issuer:always
<span class="hljs-attr">basicConstraints</span>        = critical, CA:<span class="hljs-literal">true</span>
<span class="hljs-attr">keyUsage</span>                = critical, digitalSignature, cRLSign, keyCertSign
</code></pre>
<p><strong>Generating the Private Root CA Key and Certificate:</strong></p>
<p>Now, navigate to your <code>~/.aws</code> directory in your terminal and run the following commands:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Generate the private key for your Root CA</span>
openssl genrsa -out PrivateRootCA.key 2048

<span class="hljs-comment"># Generate the self-signed Root Certificate (valid for 10 years)</span>
openssl req -new -x509 -days 3650 \
    -key PrivateRootCA.key \
    -out PrivateRootCA.pem \
    -config v3.ext
</code></pre>
<p>You'll be prompted for your Country Name, State or Province Name, Locality Name, Organization Name, and Organizational Unit Name. Provide these as per your <code>v3.ext</code> file. Crucially, <strong>leave the Common Name and Email Address fields blank</strong> when prompted.</p>
<p>To inspect the root certificate and verify that it was created successfully, you can use:</p>
<pre><code class="lang-bash">openssl x509 -text -noout -<span class="hljs-keyword">in</span> PrivateRootCA.pem
</code></pre>
<h3 id="heading-step-2-empower-your-workloads-the-client-certificate">Step 2: Empower Your Workloads – The Client Certificate</h3>
<p>With your Root CA established, you can now issue client certificates for your external workloads. Each workload that needs to access AWS will have its own unique client certificate.</p>
<p><strong>Updating</strong> <code>v3.ext</code> for Client Certificates:</p>
<p>For client certificates, we need to adjust the <code>v3.ext</code> file to include non-CA certificate settings. Modify your <code>v3.ext</code> file to look like this (add the <code>[ v3_cert ]</code> section):</p>
<pre><code class="lang-ini"><span class="hljs-section">[ req ]</span>
<span class="hljs-attr">default_bits</span>        = <span class="hljs-number">2048</span>
<span class="hljs-attr">distinguished_name</span>  = req_distinguished_name
<span class="hljs-attr">x509_extensions</span>     = v3_ca

<span class="hljs-section">[ req_distinguished_name ]</span>
<span class="hljs-attr">countryName</span>                     = Country Name (<span class="hljs-number">2</span> letter code)
<span class="hljs-attr">countryName_default</span>             = US
<span class="hljs-attr">countryName_min</span>                 = <span class="hljs-number">2</span>
<span class="hljs-attr">countryName_max</span>                 = <span class="hljs-number">2</span>

<span class="hljs-attr">stateOrProvinceName</span>             = State or Province Name (full name)
<span class="hljs-attr">stateOrProvinceName_default</span>     = California

<span class="hljs-attr">localityName</span>                    = Locality Name (eg, city)
<span class="hljs-attr">localityName_default</span>            = San Francisco

<span class="hljs-attr">0.organizationName</span>              = Organization Name (eg, company)
<span class="hljs-attr">0.organizationName_default</span>      = ABC Inc.

<span class="hljs-attr">organizationalUnitName</span>          = Organizational Unit Name (eg, section)
<span class="hljs-attr">organizationalUnitName_default</span>  = DevOps

<span class="hljs-attr">commonName</span>                      = Common Name (e.g. server FQDN or YOUR name)
<span class="hljs-attr">commonName_max</span>                  = <span class="hljs-number">64</span>

<span class="hljs-attr">emailAddress</span>                    = Email Address
<span class="hljs-attr">emailAddress_max</span>                = <span class="hljs-number">64</span>

<span class="hljs-comment"># --------------------------------------------------------------------</span>
<span class="hljs-comment"># For creating a root or intermediate CA certificate</span>
<span class="hljs-section">[ v3_ca ]</span>
<span class="hljs-attr">subjectKeyIdentifier</span>    = hash
<span class="hljs-attr">authorityKeyIdentifier</span>  = keyid:always,issuer:always
<span class="hljs-attr">basicConstraints</span>        = critical, CA:<span class="hljs-literal">true</span>
<span class="hljs-attr">keyUsage</span>                = critical, digitalSignature, cRLSign, keyCertSign

<span class="hljs-comment"># --------------------------------------------------------------------</span>
<span class="hljs-comment"># For end-entity (leaf) certificates like client/server certs</span>
<span class="hljs-section">[ v3_cert ]</span>
<span class="hljs-attr">authorityKeyIdentifier</span>  = keyid,issuer
<span class="hljs-attr">basicConstraints</span>        = critical, CA:<span class="hljs-literal">false</span>
<span class="hljs-attr">keyUsage</span>                = critical, digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
</code></pre>
<p><strong>Generating the Client Private Key, CSR, and Certificate:</strong></p>
<p>Now, generate the client's private key, a Certificate Signing Request (CSR), and then sign the CSR with your Root CA:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Generate the private key for the client</span>
openssl genrsa -out clientEntity.key 2048

<span class="hljs-comment"># Generate the Certificate Signing Request (CSR) for the client</span>
openssl req -new -key clientEntity.key -out clientEntity.csr -config v3.ext -extensions v3_cert

<span class="hljs-comment"># Sign the client's CSR with your Root CA (valid for 1 year)</span>
openssl x509 -req -<span class="hljs-keyword">in</span> clientEntity.csr -CA PrivateRootCA.pem -CAkey PrivateRootCA.key -CAcreateserial -out clientEntity.pem -days 365 -sha256 -extfile v3.ext -extensions v3_cert
</code></pre>
<p>You'll be prompted for identity attributes for the client certificate. This time, include a <code>Common Name</code> (e.g., <code>clientEntity</code>).</p>
<h3 id="heading-step-3-configure-aws-iam-roles-anywhere">Step 3: Configure AWS IAM Roles Anywhere</h3>
<p>Now that you have your certificates, it's time to set up IAM Roles Anywhere in the AWS console.</p>
<ol>
<li><p><strong>Log in to the AWS Management Console</strong> and navigate to the <strong>IAM</strong> service.</p>
</li>
<li><p>In the left-hand navigation pane, select <strong>Roles Anywhere</strong>.</p>
</li>
<li><p><strong>Create a Trust Anchor:</strong></p>
<ul>
<li><p>Click on <strong>Create trust anchor</strong>.</p>
</li>
<li><p>Choose <strong>External certificate bundle</strong>.</p>
</li>
<li><p>Upload your <code>PrivateRootCA.pem</code> file.</p>
</li>
<li><p>Give your Trust Anchor a meaningful name (e.g., <code>MyOnPremRootCA</code>).</p>
</li>
</ul>
</li>
<li><p><strong>Define a Profile:</strong></p>
<ul>
<li><p>Click on <strong>Create profile</strong>.</p>
</li>
<li><p>Give your Profile a name (e.g., <code>OnPremWorkloadProfile</code>).</p>
</li>
<li><p>Associate one or more <strong>IAM Roles</strong> with this profile. These are the roles your external workloads will assume.</p>
</li>
</ul>
</li>
<li><p>Configure IAM Role Trust Policies:</p>
<p> For each IAM role associated with your profile, you must modify its trust policy to allow <code>rolesanywhere.amazonaws.com</code> to assume the role.</p>
<p> Navigate to the IAM role, go to the <strong>Trust relationships</strong> tab, and click <strong>Edit trust policy</strong>. Add the following to the policy:</p>
<pre><code class="lang-json"> {
   <span class="hljs-attr">"Version"</span>: <span class="hljs-string">"2012-10-17"</span>,
   <span class="hljs-attr">"Statement"</span>: [
     {
       <span class="hljs-attr">"Effect"</span>: <span class="hljs-string">"Allow"</span>,
       <span class="hljs-attr">"Principal"</span>: {
         <span class="hljs-attr">"Service"</span>: <span class="hljs-string">"rolesanywhere.amazonaws.com"</span>
       },
       <span class="hljs-attr">"Action"</span>: <span class="hljs-string">"sts:AssumeRole"</span>,
       <span class="hljs-attr">"Condition"</span>: {
         <span class="hljs-attr">"StringEquals"</span>: {
           <span class="hljs-attr">"aws:SourceArn"</span>: <span class="hljs-string">"arn:aws:rolesanywhere:&lt;region&gt;:&lt;account-id&gt;:profile/&lt;your-profile-name&gt;"</span>
         }
       }
     }
   ]
 }
</code></pre>
<p> <strong>Replace</strong> <code>&lt;region&gt;</code>, <code>&lt;account-id&gt;</code>, and <code>&lt;your-profile-name&gt;</code> with your actual AWS region, account ID, and the name of the profile you created.</p>
</li>
</ol>
<h3 id="heading-step-4-access-aws-from-your-workload-with-awssigninghelper">Step 4: Access AWS from Your Workload with <code>aws_signing_helper</code></h3>
<p>AWS provides <code>aws_signing_helper</code>, a utility that facilitates the signing of requests and retrieval of temporary credentials using your client certificate and private key.</p>
<p><strong>Install</strong> <code>aws_signing_helper</code>:</p>
<p>Download and install <a target="_blank" href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/credential-helper.html">aws_signing_helper</a> for your operating system. Make sure it's in your system's PATH.</p>
<p><strong>Configure AWS CLI with</strong> <code>credential_process</code>:</p>
<p>The <code>credential_process</code> feature in the AWS CLI allows you to execute an external command to retrieve credentials. This is where <code>aws_signing_helper</code> shines.</p>
<p>Open your AWS CLI configuration file (usually <code>~/.aws/config</code>) and add a new profile:</p>
<pre><code class="lang-ini"><span class="hljs-section">[profile rolesanywhere-test]</span>
<span class="hljs-attr">credential_process</span> = aws_signing_helper credential-process \
  --certificate ~/.aws/clientEntity.pem \
  --private-key ~/.aws/clientEntity.key \
  --trust-anchor-arn arn:aws:rolesanywhere:&lt;region&gt;:&lt;account-id&gt;:trust-anchor/&lt;your-trust-anchor-id&gt; \
  --profile-arn arn:aws:rolesanywhere:&lt;region&gt;:&lt;account-id&gt;:profile/&lt;your-profile-id&gt; \
  --role-arn arn:aws:iam::&lt;account-id&gt;:role/&lt;your-iam-role-name&gt; \
  --region &lt;region&gt;
</code></pre>
<p><strong>Important:</strong></p>
<ul>
<li><p><strong>Replace placeholders:</strong></p>
<ul>
<li><p><code>&lt;region&gt;</code>: Your AWS region (e.g., <code>us-east-1</code>).</p>
</li>
<li><p><code>&lt;account-id&gt;</code>: Your AWS account ID.</p>
</li>
<li><p><code>&lt;your-trust-anchor-id&gt;</code>: The ID of your Trust Anchor (found in the IAM Roles Anywhere console).</p>
</li>
<li><p><code>&lt;your-profile-id&gt;</code>: The ID of your Profile (found in the IAM Roles Anywhere console).</p>
</li>
<li><p><code>&lt;your-iam-role-name&gt;</code>: The name of the IAM role you want to assume.</p>
</li>
</ul>
</li>
<li><p><strong>Permissions:</strong> Ensure the user running <code>aws_signing_helper</code> has read access to <code>clientEntity.pem</code> and <code>clientEntity.key</code>.</p>
</li>
</ul>
<h3 id="heading-testing-your-setup">Testing Your Setup</h3>
<p>Now, from your external workload (your local machine in this example), you can use the configured AWS CLI profile to access AWS services:</p>
<pre><code class="lang-bash">aws s3 ls --profile rolesanywhere-test
aws sts get-caller-identity --profile rolesanywhere-test
</code></pre>
<p>If everything is configured correctly, you should see your S3 buckets listed or the details of the assumed IAM role, all without ever needing to use static access keys!</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>AWS IAM Roles Anywhere provides a robust and secure mechanism for extending AWS access to your workloads running outside of the AWS cloud. By leveraging X.509 certificates and short-term credentials, you can significantly enhance your security posture and simplify credential management. This approach is fundamental for building secure and compliant hybrid cloud architectures, enabling seamless integration between your on-premises and cloud environments. Start your journey towards a more secure and efficient hybrid cloud with IAM Roles Anywhere today!</p>
]]></content:encoded></item><item><title><![CDATA[Deep Dive: Git Config Include for Multiple GitHub Accounts]]></title><description><![CDATA[While SSH configuration is a popular approach for managing multiple GitHub accounts, using Git's include directive offers a more elegant and maintainable solution. Let's explore this method in detail.
Understanding the Include Directive
Git's include...]]></description><link>https://niranx.dev/git-config-include-for-multiple-github-accounts</link><guid isPermaLink="true">https://niranx.dev/git-config-include-for-multiple-github-accounts</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Git]]></category><dc:creator><![CDATA[Niran Maharjan]]></dc:creator><pubDate>Wed, 11 Dec 2024 15:48:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733937689516/e9daa5cc-5f74-42db-b124-b06e666e6c43.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While SSH configuration is a popular approach for managing multiple <strong>GitHub</strong> accounts, using Git's include directive offers a more elegant and maintainable solution. Let's explore this method in detail.</p>
<h3 id="heading-understanding-the-include-directive">Understanding the Include Directive</h3>
<p>Git's include directive allows you to split your Git configuration into multiple files and include them conditionally based on specific criteria. This feature is particularly powerful for managing different Git identities.</p>
<h3 id="heading-directory-structure-setup">Directory Structure Setup</h3>
<p>First, organize your projects into dedicated directories:</p>
<pre><code class="lang-bash">~/code/personal/      <span class="hljs-comment"># All personal projects</span>
~/code/work/          <span class="hljs-comment"># All work-related repositories</span>
</code></pre>
<h3 id="heading-creating-specialized-config-files">Creating Specialized Config Files</h3>
<p>Create separate configuration files for each GitHub account:</p>
<h3 id="heading-personal-configuration-codepersonalgitconfig">Personal Configuration (~/code/personal/.gitconfig)</h3>
<pre><code class="lang-bash">[user]
    email = personal@email.com
    signingKey = 7D2132F509F82190
[core]
    sshCommand = <span class="hljs-string">"ssh -i ~/.ssh/id_ed25519"</span>
[github]
    user = github-personal
</code></pre>
<h3 id="heading-work-configuration-codeworkgitconfig">Work Configuration (~/code/work/.gitconfig)</h3>
<pre><code class="lang-bash">[user]
    email = work@email.com
    signingKey = 7D2132F569B82890
[core]
    sshCommand = <span class="hljs-string">"ssh -i ~/.ssh/id_ed25519_work"</span>
[github]
    user = github-work
</code></pre>
<h3 id="heading-main-git-configuration">Main Git Configuration</h3>
<p>Set up your main <code>~/.gitconfig</code> file to include these configurations based on directory paths:</p>
<pre><code class="lang-bash">[<span class="hljs-built_in">alias</span>]
        co = checkout
        add = add -a
        cm = commit -m
[color]
    ui = auto

[user]
    name = Full Name

[init]
    defaultBranch = main

[includeIf <span class="hljs-string">"gitdir:~/code/personal/"</span>]
    path = ~/code/personal/.gitconfig

[includeIf <span class="hljs-string">"gitdir:~/code/work/"</span>]
    path = ~/code/work/.gitconfig

[commit]
        gpgSign = <span class="hljs-literal">true</span>
</code></pre>
<h3 id="heading-benefits-of-this-approach">Benefits of This Approach</h3>
<ul>
<li><p>Automatic configuration switching based on project location</p>
</li>
<li><p>Reduced risk of committing with wrong credentials</p>
</li>
<li><p>Centralized configuration management</p>
</li>
<li><p>Easy to add new accounts or modify existing ones</p>
</li>
</ul>
<h3 id="heading-best-practices">Best Practices</h3>
<ul>
<li><p>Store personal projects under <code>~/code/personal/</code> directory</p>
</li>
<li><p>Keep all work projects under <code>~/code/work/</code> directory</p>
</li>
<li><p>Use meaningful names for configuration files</p>
</li>
<li><p>Regular backup of configuration files</p>
</li>
</ul>
<h3 id="heading-verification-and-testing">Verification and Testing</h3>
<p>To verify your configuration is working correctly, use these commands:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># In a personal repository</span>
<span class="hljs-built_in">cd</span> ~/code/personal/project
git config user.email  <span class="hljs-comment"># Should show personal email</span>

<span class="hljs-comment"># In a work repository</span>
<span class="hljs-built_in">cd</span> ~/code/work/project
git config user.email  <span class="hljs-comment"># Should show work email</span>
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>With this setup, you can seamlessly manage multiple GitHub accounts while maintaining a clean and organized development environment. The conditional includes handle all the complexity, allowing you to focus on your work without worrying about account switching.</p>
]]></content:encoded></item><item><title><![CDATA[Managing Multiple GitHub Accounts: A Developer's Guide]]></title><description><![CDATA[In today's development landscape, it's common to maintain separate GitHub accounts for work and personal projects. This setup helps keep professional and personal contributions clearly separated. Here's a step-by-step guide on how to manage multiple ...]]></description><link>https://niranx.dev/managing-multiple-github-accounts</link><guid isPermaLink="true">https://niranx.dev/managing-multiple-github-accounts</guid><category><![CDATA[GitHub]]></category><category><![CDATA[ssh]]></category><dc:creator><![CDATA[Niran Maharjan]]></dc:creator><pubDate>Tue, 10 Dec 2024 17:53:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/wX2L8L-fGeA/upload/c9153be61a8ee79aabc624faacbed93b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In today's development landscape, it's common to maintain separate <strong>GitHub</strong> accounts for work and personal projects. This setup helps keep professional and personal contributions clearly separated. Here's a step-by-step guide on how to manage multiple GitHub accounts on a single machine.</p>
<h2 id="heading-why-multiple-github-accounts">Why Multiple GitHub Accounts?</h2>
<p>There are several reasons why you might want to maintain multiple GitHub accounts:</p>
<ul>
<li><p>Separating work and personal projects</p>
</li>
<li><p>Managing different organizations</p>
</li>
<li><p>Maintaining distinct online identities</p>
</li>
<li><p>Compliance with workplace policies</p>
</li>
</ul>
<h2 id="heading-step-by-step-configuration-guide">Step-by-Step Configuration Guide</h2>
<h3 id="heading-1-creating-ssh-keys">1. Creating SSH Keys</h3>
<p>First, generate unique SSH keys for each account. Open your terminal and run:</p>
<pre><code class="lang-bash">
<span class="hljs-comment"># For personal account</span>
ssh-keygen -t ed25519 -C <span class="hljs-string">"personal@email.com"</span> -f ~/.ssh/id_ed25519

<span class="hljs-comment"># For work account</span>
ssh-keygen -t ed25519 -C <span class="hljs-string">"work@email.com"</span> -f ~/.ssh/id_ed25519_work
</code></pre>
<h3 id="heading-2-setting-up-ssh-agent">2. Setting Up SSH Agent</h3>
<p>Add your new SSH keys to the SSH agent:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">eval</span> <span class="hljs-string">"<span class="hljs-subst">$(ssh-agent -s)</span>"</span>
ssh-add ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519_work
</code></pre>
<h3 id="heading-3-github-configuration">3. GitHub Configuration</h3>
<p>Add your public keys to their respective GitHub accounts:</p>
<ul>
<li><p>Copy the content of each <code>.pub</code> file</p>
</li>
<li><p>Go to <strong>GitHub Settings</strong> → <strong>SSH and GPG keys</strong></p>
</li>
<li><p>Click <strong>"New SSH key"</strong> and paste your key</p>
</li>
</ul>
<h3 id="heading-4-ssh-config-setup">4. SSH Config Setup</h3>
<p>Create or modify your SSH config file (~/.ssh/config):</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Personal (Default) account</span>
Host github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_ed25519

<span class="hljs-comment"># Work account</span>
Host github-work
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_ed25519_work
</code></pre>
<h2 id="heading-using-your-configuration">Using Your Configuration</h2>
<h3 id="heading-cloning-repositories">Cloning Repositories</h3>
<p>For personal repositories:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> git@github.com:personal-username/repo.git
</code></pre>
<p>For work repositories:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> git@github-work:work-organization/repo.git
</code></pre>
<h3 id="heading-repository-specific-configuration">Repository-Specific Configuration</h3>
<p>Set up Git configuration for each repository:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Personal repository</span>
git config user.name <span class="hljs-string">"Full Name"</span>
git config user.email <span class="hljs-string">"personal@email.com"</span>

<span class="hljs-comment"># Work repository</span>
git config user.name <span class="hljs-string">"Full Name"</span>
git config user.email <span class="hljs-string">"work@email.com"</span>
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Managing multiple GitHub accounts might seem daunting at first, but with proper configuration, it becomes a seamless part of your development workflow. This setup helps maintain a clean separation between different aspects of your development life while ensuring secure access to all your repositories.</p>
]]></content:encoded></item></channel></rss>