# How to add a Git remote

> Learn how to add a Git remote to your repository with git remote add origin, pointing it at your GitHub repo so you can push your code there.

Author: Flavio Copes | Published: 2021-11-18 | Canonical: https://flaviocopes.com/git-add-remote/

Today I had to add a remote to a [Git](https://flaviocopes.com/git/) repository after [deleting the Git remote](https://flaviocopes.com/git-remove-remote/) with `git remote rm origin`, for reasons that I won't bore you with.

Then I added a new Git remote to a [GitHub](https://flaviocopes.com/github/) repository with 

```sh
git remote add origin git@github.com:flaviocopes/myrepo.git
```

Change `flaviocopes/myrepo` to your GitHub URL.

Done!
