Git 2 reference · Remotes
git remote Command (Git)
List, add, rename and remove the remote repositories a local repository talks to.
Git 2
Syntax
git remote [-v] git remote add NAME URL git remote set-url NAME URL
Parameters
| Parameter | Description |
|---|---|
-v |
Show URLs. |
add NAME URL |
Add a remote. |
set-url |
Change a remote's URL. |
remove |
Remove a remote. |
Examples
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
git init -q --bare ../origin.git
git remote add origin ../origin.git
git remote -v
Output
origin ../origin.git (fetch) origin ../origin.git (push)
Run this on your computer — see “Get Started” for setup.
git init -q -b main app && cd app
echo '# Shop' > README.md
git add README.md && git commit -q -m 'Initial commit'
git remote add upstream https://example.com/shop.git
git remote set-url upstream [email protected]:shop.git
git remote -v | grep upstream | head -1
Output
upstream [email protected]:shop.git (fetch)
Run this on your computer — see “Get Started” for setup.
Related
git push· Upload local commits and tags to a remote branch; -u sets the upstream, and --force-with-lease rewrites history safely.git fetch and git pull· Download new commits from a remote (fetch), or download and integrate them into your branch (pull).git clone· Copy a repository with its full history and set up origin as the remote; --depth makes a shallow copy.- Remotes: clone, fetch, pull and push · tutorial