git-remote

Manage remote repository connections

TLDR

List remotes
$ git remote -v
Add remote
$ git remote add [name] [url]
Remove remote
$ git remote remove [name]
Rename remote
$ git remote rename [old] [new]
Show remote details
$ git remote show [origin]

SYNOPSIS

git remote [command] [options]

DESCRIPTION

git remote manages tracked remote repositories. It configures URLs and refspecs for fetch and push operations, enabling interaction with multiple remote repositories in distributed workflows.Common operations include adding upstream remotes for fork-based development, changing URLs after repository migrations, renaming remotes, and inspecting remote configuration details like tracked branches and push/fetch URLs.

PARAMETERS

add NAME URL

Add new remote.
remove NAME
Remove remote.
rename OLD NEW
Rename remote.
show NAME
Show remote info.
set-url NAME URL
Change remote URL.
prune NAME
Remove stale tracking branches.
get-url NAME
Show URL for remote.
-v, --verbose
Show URLs.
--help
Display help information.

CONFIGURATION

.git/config

Repository remote configuration with URLs and refspecs.
$ [remote "origin"]
    url = https://github.com/user/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*

INSTALL

sudo apt install git
sudo dnf install git
sudo pacman -S git
sudo apk add git
sudo zypper install git
brew install git
nix profile install nixpkgs#git

CAVEATS

Remote names are local aliases. URLs can differ for fetch and push. Removing remote keeps fetched objects.

HISTORY

git remote is a core Git command for managing the remote repository connections essential to distributed version control.

SEE ALSO

git-fetch(1), git-push(1), git-clone(1)