Git Remote – Add online repository

Git Remote is used to manage list of online repositories being tracked by you. Following is the syntax to add an online repository to the existing git remote list.


The syntax of git command to add an online repository, without options which is generally used is

git remote add <name> <url>

The same git command to add an online repository with all available options is

git remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>


In the following example, we shall add an online repository to the git remote list, without any options.

git remote add origin

Let us check the existing list in git remote

~$ git remote -v

Well! There are no any. Lets go and add to the git remote with nameorigin. You may use any other name for the online (remote) repository

~$ git remote add origin

The online repository has been added to git remote, with nameorigin. Check the list once again.

~$ git remote -v
origin (fetch)
origin (push)

The repository has been added for push and fetch operations.


In this Git Tutorial, we have learnt to add Remote/Online repository to git remote list.