You can transfer any Git repository from GitHub.com to GitHub Enterprise by following the steps below.

  1. Create an empty repository on your GitHub Enterprise instance.

  2. Create a bare clone of your GitHub.com repository on your local machine, fetching all remote tags (refs/tags/*) and copying all remote branch heads (refs/heads/*) directly to their corresponding local branch heads.

    git clone git@github.com:[owner]/[repo-name].git --bare
    

    Tip: If you need to preserve references other than refs/heads/* or refs/tags/* (most people won't), use the --mirror flag instead of --bare. Be warned, however, that this may cause you to encounter "Hidden Ref" errors when you push your local repository to GitHub Enterprise if your GitHub.com repository has pull requests—both GitHub.com and GitHub Enterprise reject pushes to the refs/pull/ namespace. Nevertheless, these "Hidden Ref" errors won't adversely affect your repository on GitHub Enterprise.

  3. Add your GitHub Enterprise repository as a remote reference in your local clone.

    cd [repo-name]
    git remote add enterprise git@[hostname]:[owner]/[repo-name].git
    
  4. Push all local references (refs/*) up to your remote GitHub Enterprise repository.

    git push enterprise --mirror
    

(For more information, please refer to the man pages for git-clone and git-push.)

You can also migrate wikis using the above procedure because wikis are simply Git repositories that follow the special naming convention [repo-name].wiki.git. Visit http(s)://[enterprise-hostname]/[owner]/[repo-name]/wiki to create your wiki repository before you try pushing to it.

You can migrate issues and pull requests using the GitHub API, but all of their metadata (e.g. IDs, creation dates, and author information) will be replaced. In other words, everything—except for the Git commits—will appear to have been created by the user account that migrated them, at the moment that they were migrated.

You currently cannot migrate any users or organizations.