Git: git remote add command

Reading time: 15 minutes

git remote add command is a basic git command which add a remote repository as an origin of your local repository. The basic idea is that the remote repository is the final working repository which is considered by everyone and your local repository is your local copy holding your changes.

OpenGenus loves Git


Using the command git remote -v, we can find out the remote repository for your local repository. As we have not added any remote origin repository, it will provide no information.

Let us consider this repository as our origin repository. Let us add it to our local repository. The format of the command is:

git remote add <name_of_your_remote_repository> <URL_of_your_remote_repository>


As we see, we have successfully add our GitHub repository as our remote repository.

We can, now, do much more interesting things with our repository and we have made your first step towards the distributed layer of Git.