Reading Time: 3 minutes

GitHub is a free repository hosting service, used as version control for web developers to download and push their code from their servers to other users.  In our previous article on Installing Git on Ubunto 18.04, we've instructed on how to add Git to your Ubuntu VPS server. We'll continue on and show you how to add and clone a repo from GitHub to your server.

How to Create and Clone a Repo in GitHub on Ubuntu 18.04

Preflight

Step 1: Set up a GitHub Account

If you haven’t done so already, make a Github.com account, it’s free! This is where you’ll be creating a repo and putting in files.  Once you’re in your GitHub account, click Create a repository (or New Repository), which will take you to a page where you can add details for your repo.

Step 2: Create a Repo

Fill out the details for your repo and be sure to take note your repo name, you’ll need it later in this tutorial.  If you are curious about the options on this screen, the README file is common for writing instructions to your users.  The licensing option can seem confusing but if you are questioning which one to choose you can check out this site to guide you. Once all details are in, click Create repository.

You can create a repo in github.com by filling out this form.
400

Once created, you’ll see two files in your repository if you chose the licensing and README file.

Step 3: Configuring Git per User

After installing Git, configuration is needed for commit messages to be sent out.  Without setting the name and email address you’ll see warnings when making commitments to git. If you have multiple user who utilize git, make an entry for each user. You can easily set these details for a user with two commands within your server’s terminal. (If you need to access the information set you can find it in the .gitconfig file.)

Note:
If you already have a github.com account you can use the associated username and email.

git config --global user.name "Your_Name"

git config --global user.email "email_address@domain.com"

Step 4: Create A Directory

When you create a directory, you can use this space to sync newly written/edited code to your GitHub account. I’m going to call this environment git_environment and move into the directory using the cd command.

mkdir git_environment

cd git_environment

Step 5: Copy your GitHub URL

The Github url can be found by clicking the Clone or download button.

First, its necessary to clone or download our already pre-existing README and licensing file from our GitHub account.  Jump back to your GitHub account, click Clone or download and copy your GitHub link.

Step 6: Clone your Repo

In your terminal, you should find yourself in the GitHub directory.  We will first clone our repo with our copied GitHub URL and then change directories to our project name.

git clone https://github.com/username/want-some-java.git

cd want-some-java

By listing the want-some-java directory, you’ll see the two files in your repo, verifying that the cloning has worked.

ls

Example Output:LICENSE  README.md

In our next tutorial, where will teach you how to edit/create a file on your server and push the script to your GitHub account.

We pride ourselves on being The Most Helpful Humans In Hosting™!

Our talented Support Teams are full of experienced Linux technicians and System administrators who have an intimate knowledge of multiple web hosting technologies, especially those discussed in this article. We are always available to assist with any issues related to this article, 24 hours a day, 7 days a week 365 days a year.

If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone @800.580.4985, a chat or support ticket to assisting you with this process.

About the Author: Alex Gorzen

Alex Gorzen has been helping others with technology his whole life. He played with computers even before he could read and wants to make sure his children share that same love as they grow up. In his free time, he enjoys gardening, building things, and learning new skills.

Have Some Questions?

Our Sales and Support teams are available 24 hours by phone or e-mail to assist.

1.800.580.4985
1.517.322.0434

Latest Articles

Cloudstack vs OpenStack: Which is Right For You?

Read Article

Cloning an Existing Virtual Machine with VMware

Read Article

Five Steps to Create a Robots.txt File for Your Website

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article