<?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: Carl Padilla</title>
    <description>The latest articles on DEV Community by Carl Padilla (@carlpadilla).</description>
    <link>https://dev.to/carlpadilla</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%2F201195%2Fe13fbbc6-4cd8-476e-9565-e6d64959a52d.jpeg</url>
      <title>DEV Community: Carl Padilla</title>
      <link>https://dev.to/carlpadilla</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carlpadilla"/>
    <language>en</language>
    <item>
      <title>Setting up GitHub SSH on Linux</title>
      <dc:creator>Carl Padilla</dc:creator>
      <pubDate>Mon, 20 May 2024 20:53:38 +0000</pubDate>
      <link>https://dev.to/carlpadilla/setting-up-github-ssh-on-linux-4975</link>
      <guid>https://dev.to/carlpadilla/setting-up-github-ssh-on-linux-4975</guid>
      <description>&lt;p&gt;Setting up GitHub SSH on Linux is a great way to securely manage your repositories. Here’s a step-by-step guide to help you set it up:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Check for Existing SSH Keys
&lt;/h3&gt;

&lt;p&gt;First, you need to check if you already have an SSH key:&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;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; ~/.ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see files like &lt;code&gt;id_rsa&lt;/code&gt; and &lt;code&gt;id_rsa.pub&lt;/code&gt;, you already have an SSH key.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Generate a New SSH Key
&lt;/h3&gt;

&lt;p&gt;If you don't have an SSH key, you can generate a new one:&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; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"your_email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-t rsa -b 4096&lt;/code&gt;&lt;/strong&gt;: Specifies the type of key and bit length.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-C "your_email@example.com"&lt;/code&gt;&lt;/strong&gt;: Adds a comment with your email.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You'll be prompted to save the key to a specific file location. Press Enter to accept the default location (&lt;code&gt;/home/your_username/.ssh/id_rsa&lt;/code&gt;). Next, you'll be asked to enter a passphrase for added security (optional but recommended).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Add SSH Key to the SSH Agent
&lt;/h3&gt;

&lt;p&gt;Start the SSH agent:&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;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;ssh-agent &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your SSH private key to the SSH agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-add ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Add SSH Key to Your GitHub Account
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Copy your SSH key to the clipboard:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/id_rsa.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Log in to your GitHub account.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Settings&lt;/strong&gt; -&amp;gt; &lt;strong&gt;SSH and GPG keys&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New SSH key&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a descriptive title, and paste your SSH key into the "Key" field.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add SSH key&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 5: Test Your SSH Connection
&lt;/h3&gt;

&lt;p&gt;To verify that your setup is working, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a message like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi your_username! You've successfully authenticated, but GitHub does not provide shell access.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Configure Git to Use SSH
&lt;/h3&gt;

&lt;p&gt;Finally, make sure your Git configuration uses the SSH URL for GitHub. When cloning repositories, use the SSH link:&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@github.com:username/repository.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that’s it! Your GitHub SSH setup on Linux is complete. Now you can securely manage your repositories with ease. If you have any questions or run into any issues, feel free to ask!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
