GitHub is a free platform that provides repository hosting and version control, widely used by web developers to manage and share code. We will guide you to install Git on Ubuntu 24.04, adding and cloning a repository from GitHub to your Ubuntu VPS server.
The first step is to install Git on your Ubuntu server. Open a terminal and execute the following command:
sudo apt update && sudo apt install git -y
This command will install the latest version of Git on your server. To verify that Git has been installed correctly, run the following command:
git --version
If you haven't already, create a GitHub account at GitHub.com. It's free! Once you have an account, you'll be able to create a repository (repo) and add your files. To create a new repository, follow these steps:
Install GitHub CLI on your Ubuntu server and use it to clone a repository
sudo apt update
You have two main options for installing GitHub CLI: using snap
or apt
. Choose the method you prefer.
sudo snap install gh sudo apt install gh
To check if GitHub CLI is installed correctly, run:
gh --version
You should see output indicating the installed version of GitHub CLI.
Authenticate your GitHub account with the CLI. This step is necessary to interact with your repositories:
gh auth login
Follow the prompts to complete the authentication process. In this process you will get one-time code. First copy your one-time code and paste it in https://github.com/login/device ( manual )
Now, you can clone your repository using the gh
command:
gh repo clone x-dev15/private
This command will clone the private
repository from the x-dev15
GitHub account into your current directory.