Create “duplicate copy” of github repository
I see answers to similar questions and I’m sure I may just not be familiar enough with Git and Github terminology to know if they apply to my question. What I need to do is to clone an existing Github remote repository (a private repo under another person’s username that I have contributor access to) and create a new private remote repo under my account. The existing repo user is going to make significant alterations to the repo, delete, and re-push, before they do that they want me to clone and create a duplicate so we can continue working from the repo under my user. I want to preserve the commit history with the repo if possible.
I’ve cloned locally but don’t can’t seem to figure out how to push it to a new remote that isn’t origined to the original user.
2 Solutions collect form web for “Create “duplicate copy” of github repository”
We’d have to have more details, but there’s a good chance what you’re trying to do is unnecessary.
It’s quite possible the owner can accomplish their goals by creating a branch and making that branch look how they desire, possible replacing master with it, if that’s the desired end goal. They can do that without destroying all the existing history.
Or, you may be able to fork the repository. However, keep in mind that if they’re going to completely rewrite history, it will likely make it difficult to integrate the work you’re doing on the fork, assuming that’s a goal.
You also can push the copy you have cloned by deleting the current remote
git remote rm origin and creating a new one that points to a repository created under your account. Here again though, if the original repository completely changes, it will be difficult to integrate any work done on your “copy.”
Would you not be able to accomplish what you’re trying to do by forking the repository on github and then cloning and working on that?
That also retains a relationship between the two repositories and allows you the option, at a later date, of merging their changes into your repo or vice-versa.