# Integrating Private GitHub Repositories with a VPS Server

* 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
    
    * ```bash
        sudo apt update
        sudo apt install git
        ```
        
    * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684912265722/502b0bde-b6ed-4de7-816d-02be182c19de.png align="center")
        
* 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:
        
    * ```bash
        ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
        ```
        
        replace your\_email with your email
        
    * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684912489006/18421c87-a135-417d-b6a2-7ae7388e310b.png align="center")
        
* Add the SSH key to your GitHub account
    
    * ```bash
        cat ~/.ssh/id_rsa.pub
        ```
        
        copy 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
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684912783154/15ff1bdf-817e-4728-9b81-1bad5b3d4b6a.png align="center")
        
        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
        
    * ```bash
        ssh -T git@github.com
        ```
        
    * If this message comes, `Are you sure you want to continue connecting (yes/no/[fingerprint])?` enter yes.
        
    * It will show you the repo name.
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684913088022/d2939c2a-e075-40e1-93b8-ee1ed579c2da.png align="center")
        
* Clone Project from your GitHub account
    
    * Copy the SSH link
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684913147517/24058550-aff0-4dc1-a87b-243da564c7a7.png align="center")
        
    * and add it with git clone, like this
        
        `git clone git@github.com:wevlu/backend.git`
        
* Run `ls` command to verify that the project is present.
    

<mark>Done.</mark>
