Mar 232020


How to add a remote to git

  • 23 March 2020
  • ADM


How to add a remote to git - images/logos/git.jpg


To add a new remote you need to use the git remote add command on the terminal in the root folder of your repository.

The git remote add command has two parameters:

  • the remote name, the most used name is origin, but if you have multiple repositories to push more suggestive names are recommended. I will go with gitlab
  • the remote URL, for example,


C:\Users\adm\repos\jersey-hello-world>git remote add gitlab


To check the remote was added run the following command:

C:\Users\adm\repos\jersey-hello-world>git remote -v
gitlab (fetch)
gitlab (push)
origin (fetch)
origin (push)


If the remote is already present the following error will occur:

C:\Users\adm\repos\jersey-hello-world>git remote add gitlab
fatal: remote gitlab already exists.