GitHub Convert Clone to Fork (after the fact)

Viewed 50

First, as you read this, you may be asking yourself, "Why?" The reason is due to a political nature (got to love working within large enterprises :) ).

Situation:

There is a repo on github. Let's say /github.com/someorg/demorepo.
I've created my own repo in my own org (i.e. /github.com/myorg/demorepo).

Currently, these two repos are not "attached".

Is there a way that I can tell GitHub that /myorg/demorepo is a fork of /someorg/demorepo so that I can do PRs? (I can't check-in directly to /someorg/demorepo.)

Thanks!

1 Answers

Here’s what I would do:

  1. Fork the repo properly on GitHub
  2. On any local clones of the original you have, do git remote set-url origin <fork-url> (and again with --push)
  3. git push to update the fork, as usual

If you want to keep a reference to the « upstream » repo, the canonical way is git remote add upstream <upstream-url>

Related