Copy/fork a git repo on github into same organization

Just create a new repository and push to it from your working copy:

git clone [email protected]:me/myrepo-original
cd myrepo-original
git remote set-url origin [email protected]:me/myrepo-new
git push origin master

Now you have a new repository, myrepo-new, which is identical to myrepo-original.


If you do not need the fork relation (e.g. you want some kind of decoupled alternate repo for whatever reason), duplicating the repo as outlines by your Google finds and larsks's answer is fine.

If you do want to make it a fork, contact Github support ([email protected] or https://github.com/support), and they will create a fork in the same organization for you. (They're not picky about this either, you'll have just to provide an alternative name for the repo, as repo names within an account must be unique.)


Update: User Steve Rice reports in the comments below that GitHub Support stated that support would not currently/no longer set up a second fork in your account.

GitHub recently posted an article about possible alternatives to forking a repo into the same account. You can read that article here.


Use Github's Import Repository option on the + menu on top of the page or just open

https://github.com/new/import

This creates a new repository with the exact contents of the copied repository. The downside (the same as for git commands answer by Iarsks) is that it doesn't count as a fork for Github.


Another way would be to add the original repo, to be copied, as remote for our current repo.

#create a new repo in the org1 organization called myrepo-new

In your local terminal, run:

git clone [email protected]:org1/myrepo-new
cd myrepo-new
git remote -v #shows current repo link on github as origin
git remote add name-for-remote https://github.com/org1/repo-old
git remote -v #shows repo-old as name-for-remote
git fetch  name-for-remote
git merge name-for-remote/branch-to-get-from-remote
#Now fix any conflicts if present
#If number of files/commits is very high, the desktop client may hang when you try to commit your changes after merge. Try switching to Git Shell if this happens.
git status 
git commit -m "commit message"
git push origin master