%%
date:: [[2023-01-16]], [[2023-05-08]]
%%
# [[Working with remotes in Git]]
## What is a remote
A remote is like a handle for a repository that is hosted on a different server, including on a provider like [[GitHub]] or [[GitLab]].
### Get a list of all remotes
`git remote -v`
### Remove configured remote
`git remote rm origin` where `origin` is the name of the remote
### Using a remote repository
#### Setting which remote repository to use
`git remote add origin https://github.com/nicolevanderhoeven/nicolevanderhoeven.github.io.git`
#### Setting remote repository using non-default SSH key
`git remote add origin git@github-NVDH:nicolevanderhoeven/nicolevanderhoeven.github.io.git`
### Pull changes from master down to local copy
`git pull`
### Set up local branch to track remote branch
`git branch --set-upstream-to=origin/master master`
## Troubleshooting
### No tracking information for current branch
```shell
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
```
If you get this message, the branch you're working on has not yet been linked to the remote. To do this, use `git branch --set-upstream-to=origin/master master`.
```shell
nic@sopirulino docs % git branch --set-upstream-to=origin/master master
Branch 'master' set up to track remote branch 'master' from 'origin'.
```
This command will set the correct remote up with your local branch so that you don't have to do this again.