<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ali S on Medium]]></title>
        <description><![CDATA[Stories by Ali S on Medium]]></description>
        <link>https://medium.com/@alis_53922?source=rss-9c8f3284e913------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*V6AoKHV5zmjkE5IO</url>
            <title>Stories by Ali S on Medium</title>
            <link>https://medium.com/@alis_53922?source=rss-9c8f3284e913------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:54:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alis_53922/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to configure multiple SSH keys in your computer]]></title>
            <link>https://medium.com/nicasource/how-to-configure-multiple-ssh-keys-in-your-computer-8b8b01f7201a?source=rss-9c8f3284e913------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b8b01f7201a</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[management]]></category>
            <dc:creator><![CDATA[Ali S]]></dc:creator>
            <pubDate>Mon, 26 Sep 2022 15:00:18 GMT</pubDate>
            <atom:updated>2022-09-26T15:00:18.140Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="How to configure multiple SSH keys in your computer" src="https://cdn-images-1.medium.com/max/1024/1*i83t6ve3SOlzbVvzOq0Qng.png" /></figure><p>SSH is one of the most used protocols for safe data exchange. SSH connections have been commonly used to secure different types of communications between your computer and a remote host.</p><p>Frequently, developers are involved in different personal or work-related projects and are required to manage different SSH keys. Managing various SSH keys to handle different projects can be a challenging task but not one impossible to accomplish. If you are having issues with SSH key management, I’ll teach you how to configure multiple SSH keys for different GitHub accounts in this article.</p><p><strong>Basic Set Up</strong></p><p>Before starting the project, create two directories: (1) One to host all your company’s projects. And (2) the other one is to have your personal projects.</p><figure><img alt="Console command that make two directories" src="https://cdn-images-1.medium.com/max/567/0*wof053DUVZFXJQED" /></figure><p>Next, you will need to check if you already have an existing SSH key. To do this, open your terminal, which should be located at the root directory of your computer <strong>~</strong>. Then, enter ls -al ~/.ssh to see if existing SSH keys are present. Check the directory .ssh to see if you already have a public SSH key.</p><figure><img alt="Console Command to list the element in ssh directory" src="https://cdn-images-1.medium.com/max/582/0*PXRaVXRrxaIdyPoz" /></figure><p>If you receive an error that ~/.ssh does not exist, you do not have an existing SSH key pair in the default location. Don’t panic! In the next section, I’ll teach you how to create one. If you found the SSH keys, you can skip the next section and head to the config file section.</p><h3>Create a new SSH key</h3><p>If you don’t have a SSH key on your computer, and you don’t know how to generate one, here is how you can do it:</p><p>Still in the terminal of your computer’s root directory, create a .ssh directory by executing the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*XaIHzr9LRE7tzVWB" /></figure><p>Then, move inside the file and execute the following command — consider that in the command, “filename” is your key&#39;s name. Use a different file name for better management :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*QW3nsLIS_Q_OAeZh" /></figure><p>After hitting <em>Enter</em>, you should see a message: “Generating public/private ed25519 key pair”. Then, you will be asked to “Enter a file in which to save the key”. When that happens, press enter and the default location will be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*r8tlz8ko9xQ1GTRr" /></figure><p><strong>PRO-TIP:</strong> You will be asked to enter a passphrase. It is always recommended to secure your key pair with a passphrase.</p><p>When everything is done, you should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/0*SjYo6KVC9RgOo6Y3" /></figure><p><strong>Create a config file</strong></p><p>Now that we all have a .ssh/ directory, inside it, you should see a config file. If the file is not automatically generated, you can create a “config” file without adding an extension. For it, use the following structure as an example of how your file should look.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/0*XlrEPVCJo5ALqkkq" /></figure><p>Note that the file is organized into sections (personal-projects and my-company-account). Each section starts with (1) the HOST directive (“yourGithubUserName” and “yourGithubCompanyAccountUserName”) and (2) it specifies the key used when establishing a connection with the remote server.</p><p>The SSH client reads the configuration file, and if more than one pattern matches, the options from the first matching take precedence.</p><h3>Create a .gitconfig file</h3><p>In your root directory <strong>~</strong>, you need to create a .gitconfig file as it will allow git to understand which key should be used depending on the directory path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*7CqyT-PZCrS309Sl" /></figure><p>Note that you will need to create a /.gitconfig file for each account you created a key. The file will contain the linked account’s email and username with the corresponding key pair. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/0*8oDek_zqQJLL2sCY" /></figure><h3>Adding your SSH key to the ssh-agent</h3><p>First, you need to make sure the ssh-agent is running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/0*J1IcNL1d9hzaGU8C" /></figure><p>Note that depending on your environment, you may need to use a different command. It may be: sudo -s -h before starting the ssh-agent, or you may need exec ssh-agent with bash or exec ssh-agent zsh.</p><p>Once your ssh-agent is running, you can add your ssh-key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/0*MXkl0IzYFiLcLrFY" /></figure><h3>Last but not least…</h3><p>To add your SSH key to your GitHub account, check the <a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account">detailed instruction and guidance</a> from the official documentation. It is important to mention that every time you want to clone a repo, you need to edit the link that the GitHub repo generates:</p><p>Instead of this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/0*gjU-R_dfxolT_IPP" /></figure><p>You must do it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/0*o-mDjWj55rDY5kjB" /></figure><p>And that’s all, folks!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*vTtY5S4RTpBLwHV1" /></figure><p>I hope you have found this article useful. Comments and thoughts are appreciated. If you think I have skipped any steps or something went wrong for you, share it in the comments! And don’t forget to tell us what else you did to make it work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b8b01f7201a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nicasource/how-to-configure-multiple-ssh-keys-in-your-computer-8b8b01f7201a">How to configure multiple SSH keys in your computer</a> was originally published in <a href="https://medium.com/nicasource">NicaSource</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>