Git

How to Clone GitHub Public Repository in Git?

Git is widely utilized for tracking changes in the source code and it also enables multiple developers to work with each other on the same project. Sometimes, they are required to clone a GitHub repository to work on remote projects locally. To that end, developers employ cloning, which allows users to perform local modifications to the repository without committing and pushing them over to the remote repository.

This blog will briefly explain the procedure to clone GitHub public repository in Git.

How to Clone GitHub Public Repository in Git?

To clone GitHub public repository in Git, do follow the below-stated step-by-step procedure:

  • Sign into your GitHub account.
  • Navigate toward your repositories.
  • Redirect to the target repository.
  • Copy the HTTP URL of the selected repository.
  • Move toward the repository in the Git bash terminal.
  • Clone the repository using the “git clone” command.

Step 1: Sign into GitHub
First, sign in to your GitHub account by hitting on the provided link as Sign in to GitHub. For that purpose, enter your email address and password in the specified fields and hit on the “Sign in” button:

Step 2: Navigate to Your Repositories
Next, click on the profile icon, and a drop-down menu will appear on the screen. Click on the below-highlighted “Your repositories” option:

Step 3: Choose Public Repository
Select your desired public remote repository which needs to clone. For that purpose, have selected the “testproject” repository:

Step 4: Copy HTTPS URL
Then, click on the “Code” button and copy the “HTTPS” URL:

Step 5: Navigate Toward the Local Repository
Next, go to the Git local repository with the help of the “cd” command:

cd "C:\Users\user\Git\testproject"

Step 6: Clone the Repository
Execute the “git clone” command along with the copied public remote repository link and clone it:

git clone http://github.com/Gituser213/testproject.git

Output

That’s all about the cloned GitHub public repository in Git.

Conclusion

To clone GitHub public repository in Git, first, sign into your GitHub account and move to the existing repositories. Next, redirect to the target public repository and copy its HTTP URL. Then, clone the repository by applying the “git clone” command. This post illustrated the method for cloning the GitHub public repository in Git.

About the author

Hafsa Javed