Skip to content

Instantly share code, notes, and snippets.

@benschw
Last active September 24, 2024 18:24
Show Gist options
  • 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