Create and Clone a Repo in Github on Ubuntu 18.04

Reading Time: 2 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 we’ve instructed on how to add Git to your Ubuntu 18.04 server. We’ll continue on and show you how to add and clone a repo from Github to your server.

Pre-flight

 

Step 1: Github Account Setup

If you haven’t done so already, make a Github.com account, its free! This is where you’ll be creating a repo and putting in files.  Once you’re in your hubspot 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 Repo via Browser

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.

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

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.The Github url can be found by clicking the Clone or download button.

 

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.

 

Author Bio

About the Author: Echo Diaz

Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts has to lead to a career in professional writing. As a top tier support specialist, she adds a distinctive element to her written work that speaks to customer feedback and concerns.

Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.

Get 33% off the first 3 months on a new VPS! Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7x365 Support