Skip to content

Instantly share code, notes, and snippets.

@Hollywood
Last active November 7, 2017 03:05
Show Gist options
  • Save Hollywood/eea0b048e25853dae3aa7c78b2f17fc2 to your computer and use it in GitHub Desktop.
Save Hollywood/eea0b048e25853dae3aa7c78b2f17fc2 to your computer and use it in GitHub Desktop.

Moving Git repositories to GitHub

  1. Ensure you have the repository cloned locally and that it is up to date.
    a. git clone <repo-address> if the repository is not locally available (the cd into the newly created directory). b. If you had it available and did not need to clone type git pull to make sure you have the most recent changes from origin (your current Git host) in your local repository.
  2. Create the destination repository on your GitHub Enterprise instance.
  3. Change the origin URL of your local repository to point to the new GitHub repository.
    a. git remote set-url origin <address-to-repo-here>
  4. Push the repository, with all branches, to GitHub Enterprise.
    a.git push origin "refs/remotes/origin/*:refs/heads/*"
    • This may prompt you for your username and password.
    • If it does and you happen to run across an issue regarding your password due to your LDAP configuration, generate a Personal Access Token and use it as your password in the terminal. This can be found under your profile settings. Remember, once you generate this token it cannot be retrieved, so keep it somewhere safe!

Your repository and all its branches should now be on the Enterprise server.

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