Skip to main content
Git FAQ
Frequently asked questions around Git and Version Control.
Git FAQ featured image

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


Tip

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:

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.