Git Commands
An overview of the most important Git commands
Git Commands featured image

git remote

The "remote" command helps you to manage connections to remote repositories.

It allows you to show which remotes are currently connected, but also to add new connections or remove existing ones.

Important Options

-v

Shows URLs of remote repositories when listing your current remote connections. By default, listing remote repositories only shows you their shortnames (e.g. "origin"). Using the "-v" option, you will also see the remote's URLs in listings.

add <shortname> <url>

Creates a new connection to a remote repository. The "shortname" you provide can later be used instead of the URL when referencing the remote. A typical default shortname is "origin": this is used for the remote which your local repository was cloned from.

remove <name>

Disconnects the remote from the local repository. Note that this will have no effect on the actual remote repository (i.e. the repository itself is not removed / deleted / etc.).

rename <old-name> <new-name>

Renames the remote connection.

The Git Cheat Sheet

No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!

Usage Examples

You can request a list of all remote repositories that are currently connected to your local repository:

$ git remote -v
  origin  https://test@github.com/test/example.git (fetch)
  origin  https://test@github.com/test/example.git (push)

Use the "add" parameter if you want to connect a new remote repository, in this example named "production":

$ git remote add production https://test@github.com/test/example.git


Tip

Easily Manage Your Remote Repositories

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 connect your accounts, cloning and creating remote repositories is just a single click away:

Try it free for 30 days and see why 100,000 developers all over the world use Tower to be more productive with Git!


Learn More

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.