Integrating Private GitHub Repositories with a VPS Server
Here to give you guys a good read, in a different way with each blog. Not a niche-specific blogger. To be honest, I'm just blogging with the aim of applying knowledge to achieve practical goals.
Make a Github repo, and push the code to the repo.
Login to the server by SSH
Check if git is installed or not at the server, if not
sudo apt update sudo apt install git
Generate an SSH key on the VPS server,
To establish a secure connection between your VPS server and GitHub, you'll need to generate an SSH key on the VPS server.
Run the following command on your VPS server:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"replace your_email with your email

Add the SSH key to your GitHub account
cat ~/.ssh/id_rsa.pubcopy the key.
Go to Your Github Repo
Click on the Settings Tab
Click on the Deploy Keys option from the sidebar
Click on Add Deploy Key Button and Paste Remote Server's Copied SSH Public Key then Click on Add Key

you can add "ssh" as the Title and paste the key copied into Key
Verify the Connection
Go to Your Server Terminal then run below
ssh -T git@github.comIf this message comes,
Are you sure you want to continue connecting (yes/no/[fingerprint])?enter yes.It will show you the repo name.

Clone Project from your GitHub account
Copy the SSH link

and add it with git clone, like this
git clone git@github.com:wevlu/backend.git
Run
lscommand to verify that the project is present.
Done.



