Skip to content

Instantly share code, notes, and snippets.

@benschw
Last active September 20, 2023 08:54
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save benschw/7268134 to your computer and use it in GitHub Desktop.
Save benschw/7268134 to your computer and use it in GitHub Desktop.
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

Rename origin to upstream and add our new empty repo as the origin.

$ git remote rename origin upstream
$ git remote add origin https://github.com/benschw/new-presentation.git
$ git remote -v

origin  https://github.com/benschw/new-presentation.git (fetch)
origin  https://github.com/benschw/new-presentation.git (push)
upstream    https://github.com/hakimel/reveal.js.git (fetch)
upstream    https://github.com/hakimel/reveal.js.git (push)

Push from your local repo to your new remote one.

$ git push -u origin master
@GMTSE
Copy link

GMTSE commented Feb 5, 2020

Hi,

  1. Apparently link to adrianshort.org is dead :( But still accessible here

  2. I just tried that with 2 GitLab projects, but when I go back to GitLab's web UI , the new project is not marked as a fork of the initial one.

  • Is it the case with GitHub also?
  • Do you have an idea why?

@K0-RR
Copy link

K0-RR commented Dec 18, 2021

I just tried that with 2 GitLab projects, but when I go back to GitLab's web UI, the new project is not marked as a fork of the initial one.
Is it the case with GitHub also?

Yes, does anybody knows how to fix this? Sorry for the necropost...

@harveyadcock
Copy link

Hi,

  1. Apparently link to adrianshort.org is dead :( But still accessible here
  2. I just tried that with 2 GitLab projects, but when I go back to GitLab's web UI , the new project is not marked as a fork of the initial one.
  • Is it the case with GitHub also?
  • Do you have an idea why?

Yes, confirmed that when doing this, the fork doesn’t appear as a fork in the GitHub UI. Anybody know how to fix this or if it’s the expected behaviour?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment