# Connect a Local Repo — GitHub

Source: https://www.geekswithgeeks.com/en/github/gh-connect-remote

> Point an existing local repo at GitHub and push it for the first time.

## Add the remote

`git remote add origin` points your local repo at the GitHub repo's URL. `origin` is just the conventional name for it.

```bash
git remote add origin https://github.com/username/my-app.git
git remote -v
```

## Push for the first time

`-u` sets the upstream branch, so future `git push` / `git pull` need no arguments.

```bash
git push -u origin main
```

## HTTPS vs SSH

HTTPS asks for a token or password unless cached; an SSH key lets you push without typing credentials each time.
