If you are looking to check, or configure the connection to a remote Git repository from your local working copy you can use the `git remote` command.

## Adding a remote repository

To connect to a remote repository, run this command:

```bash
$ git remote add origin git@github.com:robertlyall/shop.git
```

This will add a remote, named origin that connects to the specified URL.

You can then run commands such as [`git pull`](/git/commands/git-pull) and [`git push`](/git/publishing-local-changes) to update your working copy, or the remote respectively. For a walkthrough of pushing changes, see [publishing local changes](/git/publishing-local-changes).

## Removing a remote repository

If you have a remote already configured and you wish to remove the connection to it, simply type:

```bash
$ git remote rm origin
```

This will remove the connection to the remote named `origin`. This does not effect anything on the remote itself and will prevent you from being able to push and pull. 

## View a list of currently configured remotes

If you want to check which remotes are already configured in your current repository, type:

```bash
$ git remote -v
origin	git@github.com:robertlyall/shop.git (fetch)
origin	git@github.com:robertlyall/shop.git (push)
```

The output as you can see above, shows the name of the repository, followed by the URL. If you have multiple remotes, they'll be displayed in an alphabetically ordered list in the same format.

You can also use [`git fetch`](/git/commands/git-fetch) to download new data from the remote without merging it into your working branch.

## Update an existing remote

You may need to update an existing remote, for example if you've migrated from one repository hosting provider to another. You can, of course, remove the old remote and add the new one, but a simpler way of doing it would be:

```bash
$ git remote set-url origin git@codebasehq.com:robertlyall/shop.git
```

This will simply overwrite the old URL for the remote named `origin`.

Once your code is ready, [DeployHQ](https://www.deployhq.com) can deploy it to your servers automatically from any Git repository.