<?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: Md. Mehedi Hasan Nabil</title>
    <description>The latest articles on DEV Community by Md. Mehedi Hasan Nabil (@md-mehedi-hasan-nabil).</description>
    <link>https://dev.to/md-mehedi-hasan-nabil</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%2F884000%2F305a09fb-1c52-4064-bd6d-3da7b2039286.JPG</url>
      <title>DEV Community: Md. Mehedi Hasan Nabil</title>
      <link>https://dev.to/md-mehedi-hasan-nabil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/md-mehedi-hasan-nabil"/>
    <language>en</language>
    <item>
      <title>🚀 How to Set Up an EC2 Instance and Clone a Private GitHub Repo Using SSH</title>
      <dc:creator>Md. Mehedi Hasan Nabil</dc:creator>
      <pubDate>Fri, 25 Jul 2025 03:42:05 +0000</pubDate>
      <link>https://dev.to/md-mehedi-hasan-nabil/how-to-set-up-an-ec2-instance-and-clone-a-private-github-repo-using-ssh-do0</link>
      <guid>https://dev.to/md-mehedi-hasan-nabil/how-to-set-up-an-ec2-instance-and-clone-a-private-github-repo-using-ssh-do0</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; &lt;br&gt;
Create an EC2 Instance on AWS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the AWS EC2 Dashboard.&lt;/li&gt;
&lt;li&gt;Click Launch Instance.&lt;/li&gt;
&lt;li&gt;Choose the Ubuntu AMI (Amazon Machine Image).&lt;/li&gt;
&lt;li&gt;Select the instance type (e.g., t2.micro for free tier).&lt;/li&gt;
&lt;li&gt;Configure storage, security group (allow SSH port 22), and key pair.&lt;/li&gt;
&lt;li&gt;Launch the instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; &lt;br&gt;
Connect to Your EC2 and Generate SSH Key&lt;br&gt;
After your EC2 is running:&lt;/p&gt;

&lt;p&gt;a. Connect to your instance from your computer:&lt;br&gt;
&lt;code&gt;ssh -i your-key.pem ubuntu@your-ec2-public-ip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;b. Inside EC2, create a new SSH key:&lt;br&gt;
&lt;code&gt;ssh-keygen&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;c. Go into the SSH folder:&lt;br&gt;
&lt;code&gt;cd ~/.ssh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;d. List the files to see your keys:&lt;br&gt;
&lt;code&gt;ls&lt;/code&gt;&lt;br&gt;
You might see something like&lt;br&gt;
&lt;code&gt;authorized_keys  id_ed25519  id_ed25519.pub&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The .pub file is your public key — that’s what you’ll add to GitHub.&lt;/p&gt;

&lt;p&gt;e. Show your public key:&lt;br&gt;
&lt;code&gt;cat id_ed25519.pub&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You will see something like this:&lt;br&gt;
&lt;code&gt;ssh-rsa AAAAB3NzaC1... ubuntu@your-ec2-public-ip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy the whole key!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; &lt;br&gt;
Add This Key to GitHub&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open &lt;a href="https://github.com" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Go to Settings &amp;gt; SSH and GPG keys.&lt;/li&gt;
&lt;li&gt;Click New SSH key.&lt;/li&gt;
&lt;li&gt;Paste the key you copied from EC2.&lt;/li&gt;
&lt;li&gt;Give it a name like "EC2 Key" and click Add.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; &lt;br&gt;
Test Connection with GitHub&lt;/p&gt;

&lt;p&gt;Go back to your EC2 terminal and run:&lt;br&gt;
&lt;code&gt;ssh -T git@github.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Type yes if asked.&lt;br&gt;
If everything worked, you’ll see:&lt;br&gt;
&lt;code&gt;Hi your-username! You’ve successfully authenticated...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; &lt;br&gt;
Clone Your Private Repo&lt;/p&gt;

&lt;p&gt;Now clone your private GitHub project:&lt;br&gt;
&lt;code&gt;git clone git@github.com:your-username/your-private-repo.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;🎉 That’s it! You now have your private GitHub repo on your EC2 server!&lt;/p&gt;

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