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.
You need to add the project title and description there, as shown in the screen below:
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:
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
Next, let's commit and push the changes to GitHub.
git add .
git commit -m "First commit."
git push origin main
Now, on the GitHub repository, you will see the added file with the commit:
That's it! You have successfully made your first commit.
Thank you for reading this blog!