How to Clone Github Repository using Command Line - TechvBlogs

How to Clone Github Repository using Command Line

Discover the simplicity of cloning GitHub repositories with ease using the command line. Uncover step-by-step instructions and gain the skills to efficiently replicate projects and collaborate seamlessly.


Smit Pipaliya - Author - TechvBlogs
Smit Pipaliya
 

2 months ago

TechvBlogs - Google News

This tutorial guides you on how to create and clone a GitHub repository. We will explore the example of the GitHub clone repository command line. The article provides detailed information on the GitHub create repository command line. Additionally, we will demonstrate how to clone a GitHub repository in Ubuntu. Let's dive into the steps.

How to Clone Github Repository using Command Line

In this tutorial, I will show you step by step how to create a GitHub repository and how to clone a GitHub repository using the command line interface. Simply follow the steps below to create your own GitHub repository.

Let's follow the steps below:

Step 1: Create Github Repository

In the first step, click the link below to go to the GitHub repository creation page.

Create New Github Repository

You need to add the project title and description there, as shown in the screen below:

How to Clone Github Repository using Command Line - TechvBlogs

Afterward, click the "Create Repository" button.

Step 2: Clone Github Repository using Command Line

Here, you can obtain the clone repository path from the screenshot below:

How to Clone Github Repository using Command Line - TechvBlogs

Then, simply paste it with the git clone command, as shown below:

git clone [email protected]:techvblogs/new-repo.git

Step 3: Push Code First Time

After cloning the repository, you can make your first commit and push code to GitHub. Let's create a new file called index.html and write something in that file. If you are using Ubuntu, run the command below to create the file:

touch index.html

Now, you can check the changes you made using the git status command:

git status

How to Clone Github Repository using Command Line - TechvBlogs

Next, let's commit and push the changes to GitHub.

git add .
  
git commit -m "First commit."
  
git push origin main

How to Clone Github Repository using Command Line - TechvBlogs

Now, on the GitHub repository, you will see the added file with the commit:

How to Clone Github Repository using Command Line - TechvBlogs

That's it! You have successfully made your first commit.

Thank you for reading this blog!

Comments (0)

Comment


Note: All Input Fields are required.