2

There is this codebase that I want to fork but GitHub won't allow me to do that because I already have a similar project in my GitHub but from a different codebase.

I tried clicking on fork but I received an exception stating "No more forks can be created. These forks already exist."

Nicolas
  • 51
  • 12
Daniel
  • 29
  • 2
  • 1
    To fork it again, you need to delete the existing one. But, if all you want to do is to get the latest changes, a `git pull` should be enough. – notrev Feb 23 '23 at 13:31

1 Answers1

1

If I understand you well, you want to take commits from two different repositories. One is the repository origin which you already forked. The other is from another user which forked it as well, but GitHub will not allow you to refer to multiple forks.

If you want to take the changes from another Git repository, and you have already forked one, then you already have the remote origin added when you clone it. What you can do is to add a new remote reference in your local git repo.

Notice GitHub will not recognize it as two forks, in fact, the remote will be just locally. Not sure how you would manage it, and I do not recommend it by myself, but what I would do in this case would be to clone the repository locally, then add a new remote:

git remote add <new-name-to-the-remote> <link-to-repository>

In this way you can refer to both of them. The remote origin will point to the current fork, and the new remote you add (call it what you want, say repo-of-user-x or another-repo). Now, how to handle them depends on what you want to do. For example, if you want checkout a branch from the other repo, checkout the question https://stackoverflow.com/a/1783426/2084091 (specifically the refered answer), and if you want to pull the changes into your current branch, checkout the question How to pull from a different remote branch in git.

E. Zacarias
  • 598
  • 6
  • 19