Skip to content

Instantly share code, notes, and snippets.

@adamjmurray
Created December 1, 2010 06:34
Show Gist options
  • Save adamjmurray/723081 to your computer and use it in GitHub Desktop.
Save adamjmurray/723081 to your computer and use it in GitHub Desktop.
How to copy a github repository

I recently wanted to make a copy of a github project. It sounds like I basically want a fork but, as of November 2010, github does not allow you to fork your own project. I think the following steps are currently the most straightforward to copy a project.

First, I setup a new project on github.com, let's call it "new_project_name". Let's call the original project "old_project_name". I will also refer to my github username as "github_username".

After new_project_name was created on github, I ran the following commands:

cd some_temp_dir
git clone [email protected]:github_username/old_project_name.git
mv old_project_name new_project_name
cd new_project_name
git remote rm origin
git remote add origin [email protected]:github_username/new_project_name.git
git push origin master
cd ..
mv new_project_name ~/my_usual_workspace_area

Now the cloned project is detached from the original and I can work on them independently.

In my situation, I was actually splitting a single project into two projects. Maybe in this case it made more sense to copy the project than to fork it, because I don't expect to ever merge the copied project back into the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment