Connecting Ubuntu with GitHub (AWS/Azure/GCP)

Shameel Uddin - Aug 19 '23 - - Dev Community

Hello everyone, in this blog, we are gonna learn something pretty basic connectivity which is required in an Ubuntu (20.04) machine whether it is hosted on AWS, Azure, GCP, your laptop or you are running it in VM or container within your machine.

PS. For cloud solutions, make sure that the outgoing port 22 is open in your security group for your machine.

Shorter Route

If you don't want to read the whole thing just do this:

Hit these commands:

sudo apt-get install git

git config --global user.name "Shameel Uddin"
git config --global user.email "shameel.uddin@ehasabtech.com"

ssh-keygen -t ed25519 -C "shameel.uddin@ehasabtech.com"

ssh-add ~/.ssh/id_ed25519

Enter fullscreen mode Exit fullscreen mode

Add Key to your GitHub
https://github.com/settings/keys
then do this:

ssh -T git@github.com 
Enter fullscreen mode Exit fullscreen mode

Longer Route. Moving forward...

Installing Git

Install Git in your machine if it is not already installed.

sudo apt-get install git
Enter fullscreen mode Exit fullscreen mode

Image description

Do some basic Git configuration

Configure your username and email.

git config --global user.name "Shameel Uddin"
git config --global user.email "shameel.uddin@ehasabtech.com"
Enter fullscreen mode Exit fullscreen mode

Image description

Starting SSH-Agent

eval "$(ssh-agent -s)"
Enter fullscreen mode Exit fullscreen mode

Image description

Generate the Key

ssh-keygen -t ed25519 -C "shameel.uddin@hasabtech.com"
Enter fullscreen mode Exit fullscreen mode

This command will ask you where you want to keep it saved. You can keep it to default location which is up to you, it might be better if you don't as anyone would know where they are considering someone gain access to the machine.
Anyways, it further ask for passphrase. Give passphrase and move forward.
For simplicity, I am keeping it to default location with no passphrase.

Image description

Add key to SSH Agent

ssh-add ~/.ssh/id_ed25519
Enter fullscreen mode Exit fullscreen mode

Image description

Copy your public key

cat ~/.ssh/id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

Image description

Add it to GitHub

Go to this link:

https://github.com/settings/keys
Enter fullscreen mode Exit fullscreen mode

Click on New SSH Key

Image description

Add it as Authentication Key. Give Name and the key you copied from last step.

Image description

After being added, the page should appear like this:

Image description

Check Connectivity:

You can check connectivity like this:

ssh -T git@github.com 
Enter fullscreen mode Exit fullscreen mode

Image description

Cloning Project

I made a mistake of cloning from HTTPS so please do not make this mistake and clone from SSH as mentioned below =)

Image description

It's done 🥳

Thank you for reading!

Follow me here:
LinkedIn: https://www.linkedin.com/in/shameeluddin/
GitHub: https://github.com/Shameel123

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player