How to Manage Remote Repositories in Git
A remote repository is a version of your project hosted on a server — typically on GitHub, GitLab, Bitbucket, or similar platforms. The git remote command manages the connections between your local repository and those remotes.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
List Remote Connections
To see which remotes are currently connected to your local repository, along with their URLs:
$ git remote -v
origin https://test@github.com/test/example.git (fetch)
origin https://test@github.com/test/example.git (push)
Add a Remote
To connect a new remote repository, provide a shortname and its URL. The conventional shortname for a repository's primary remote is origin:
$ git remote add origin https://github.com/gittower/example.git
For additional remotes — for example a separate production server — use any shortname you like:
$ git remote add production https://test@github.com/test/example.git
Remove a Remote
To disconnect a remote from your local repository. This only removes the connection — the actual remote repository is not affected:
$ git remote remove production
Rename a Remote
To rename an existing remote connection — for example, renaming origin to upstream when you want to distinguish between your fork and the original repository:
$ git remote rename origin upstream
No Command Line Needed
Managing Remote Repositories in Tower
The Tower Git client allows you to manage all of your remote repositories (on GitHub, GitLab, Bitbucket, Azure DevOps and more) right from your desktop. Once you've connected your accounts, cloning and creating remote repositories is just a single click away:
Download the Cheat SheetFree
Get 18 of our most popular Cheat Sheets in one handy ZIP!

Thanks! Please Check Your Inbox!
Want to win one of our awesome Tower shirts?
Tell your friends about the package!
