How to fork a non-GitHub repo on GitHub?

2020-06-03 04:50发布

问题:

Is there a best practice for this? I was thinking either to

  • Create a repo, add original repo as upstream remote

  • Create a "mirror" repo, then fork that

  • Create a "mirror" repo, then create a "topic branch"

  • Something else

related: help.github.com/send-pull-requests

回答1:

This is what I ended up doing:

  1. Create new repo on GitHub

  2. Clone the new repo

    git clone git@github.com:svnpenn/spoon-knife.git
    
  3. Add source code from original repo

    cd Spoon-Knife
    git remote add upstream git://spoon.com/knife.git
    git fetch upstream
    git merge upstream/master
    
  4. Push original source code to new repo

    git push origin master
    
  5. At this point you can start committing your own source code!

source: help.github.com/fork-a-repo



回答2:

GitHub allows you to import an existing repository on Git, Subversion, Mercurial, and TFS.

See https://github.com/new/import