git remote --Add / Modify / Delete Remote Repository

The git remote command is a command to add / modify / delete a remote repository. To be more precise, it is a command to add / change / delete a simple name that represents a remote repository expressed by a URL.

The following explanation is written in terms of adding / changing / deleting the remote repository for convenience, but the actual content is adding / changing / deleting the simple name that represents the remote repository expressed in the URL. Please be aware of that.

Add remote repository

Use the "git remote add" command to add a remote repository. The first argument is the name of the remote branch and the second argument is the URL of the remote branch.

The name of the default remote repository is customarily "origin".

#Add remote repository
git remote add origin git@github.com:yuki-kimoto/perlzemigit.git

Modify remote repository

Use the "git remote set-url" command to change the URL that the remote repository name points to.

git remote set-url origin git@github.com:yuki-kimoto/ohter.git

Delete remote repository

Use the "git remote remove" command to remove a remote repository.

git remote remove origin

Display list of remote repositories

Use "git remote" to see a list of remote repositories.

git remote

This is a sample output result.

origin

If you want to know which URL the remote repository points to, use the "-v" option of "git remote".

git remote -v

This is a sample output result.

origin git@github.com:yuki-kimoto/perlzemigit.git (fetch)
origin git@github.com:yuki-kimoto/perlzemigit.git (push)

Associated Information