Home Windows How to Clone Git Repository

How to Clone Git Repository

I am new on git. How can I make a clone of git repository?

In this article, you will know how to clone git repository on local system through commands. After creating clone how to add files to repository ? Step by step snapshots are attached to make things simple for you.

Required

1. TortoiseGit installed on local system.
2. Repository URL to create a clone.

1. Create Clone

To create a clone of a remote repository is very simple. When you install the TortoiseGit, then there is an option to install git bash.
1. First, go to the folder where you will make a clone.
2. Just run the following command on git bash terminal.
3. Git clone is created.

$ git clone https://github.com/itsmearunchandel/firstrepo
Git Clone a Remote RepositoryGit Clone a Remote Repository

2. Add Identity to Commit Changes

Need to set the email address to commit the changes on the repository. Go to git cloned folder and run the command.

$ git config --local user.email "youremail@itsmearunchandel.com"
$ git config --local user.name "Your Name"

3. Add files to Repository from local System

For example, creating a new file “first1file”. Run the below command to add a single file to the remote repository. Go to the git cloned folder.

Adding All Files:

$ git add -A

Add Single File:

$ git add first1file.txt
git add commandgit add command

It shows the + sign icon. Now commit the newly added file. This commit only to the local repository.

$ git commit first1file.txt  -m "new added file commit"

-m = shows message when you commit your changes.

git commit commandgit commit command

4. Push Changes to Remote Repository

Git commit command only commits your changes to the local system. Now push the changes to the remote repository.

$ git push origin master

READ MORE: Git option is not showing on Right Click


Conclusion: You have learned how to git clone a remote repository on your local system. Git commits files and git push commands are explained. For any doubts or suggestion, kindly write in the below comment box.

LEAVE A REPLY

Please enter your comment!
Please enter your name here