Setting up a GitHub repo for an existing local git repo

Let’s say you have a repo at ~/my-git-repo and you want to create a new repo on GitHub to push it to. Here’s how you do it.

  1. Create a repo on GitHub – let’s call it my-new-git-repo. Don’t let GitHub create anything for it.
  2. On your local machine, add a “remote” to the repo. git remote add origin https://github.com/myuser/my-new-git-repo.git
  3. Push, as in git push

That was easy! I think I got myself into trouble before by letting GitHub create a README and so on.

Posted Wednesday, January 11, 2023

Blog contents