The git provides differernent commands in order to add new repositories and related information. The
git remote add origin command is used to a remote repository as an origin.
“git remote add origin” Syntax
The syntax of the
git remote add origin command is like below where the remote git repository is provided as parameter
$ git remote add origin email@example.com:USER/REPO.git
- USER is the user name that is generally added to the repository.
- REPO is the repository name that is also added to the repository.
Add Remote Origin
In the following example, we add the “firstname.lastname@example.org/ibaydan/wisetut” as the remote origin for the current git repository.
$ git remote add origin email@example.com/ibaydan/wisetut
“git remote set-url origin” Command
After setting a remote repository we may need to change this existing repository. The
git remote set-url origin command is used to change the existing remote repository URL.
$ git remote add origin firstname.lastname@example.org/ibaydan/linuxtect