How can I fork my own GitHub repository?

前端 未结 7 2310
南笙
南笙 2020-11-30 06:19

So, total newbie to Git. Been reading through the guides and think I have the basics but am having difficulties accomplishing this one goal.

I have a repo created fo

7条回答
  •  醉话见心
    2020-11-30 07:02

    Surprised no-one has referenced this guy's blog post yet.

    Here's the relevant steps:

    $ git clone git@github.com:YOURNAME/foo.git bar
    $ cd bar
    $ vim .git/config
    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@github.com:YOURNAME/bar.git #replace foo with bar
    $ git remote add upstream git@github.com:YOURNAME/foo.git
    $ git push -u origin master
    

    Instead of editing the config, I usually use a combination of git remote remove and git remote add.

    You could also use git remote rename followed by git remote add if you wanted to keep the upstream origin around.

提交回复
热议问题