Forking Own Repo on Github

In some cases I need to develop a new project which is based my other project. Some people suggest to do branching but that was not exactly what I needed, because I need to have a new name.

So, after reading several sources (this and this), this is how I fork my own repo (please note that I did this under linux):

git clone https://github.com/your_user_name/your_old_repo your_new_repo
cd your_new_repo/

Now edit the Git configuration file (your_new_repo/.git/config) using your favorite editor, and find this lines:

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://github.com/your_user_name/your_old_repo.git

Then update the url by replacing “your_old_repo” with “your_new_repo“, so it will look like this:

url = https://github.com/your_user_name/your_new_repo.git

After that:

git push origin master
Advertisements