Published on

How to publish existing repo to a new remote

  • avatar
    Sedky Haider

Let’s say you fork a public open source repo to your laptop, then decide you’re ready to publish it to your own repository.

So if I clone a public repo:

$ git clone
clone complete
$ git remote -v
origin (fetch)
origin (push)

It’s pointing at the old repo. If I’m ready to publish this repo to another host, then first I create my new repo on GitHub (or wherever), then change git origin to it and push:

$ git remote rm origin
$ git remote add origin
$ git remote -v
origin (fetch)
origin (push)
$ git push

Viola! published code to new remote.