0

I have some products with all codebase on a git server now, I want to take all this code for each product to Github. How can I do this with all the commit history?

Stack_IQ
  • 438
  • 5
  • 20
  • just `git push` them to the new repository. – Thilo Apr 06 '16 at 04:04
  • Will this preserve my git commit history?? Is there any chances that I can miss anything? – Stack_IQ Apr 06 '16 at 04:05
  • 1
    Make sure you push all the tags and branches that you need (not just master). Then nothing should be lost. – Thilo Apr 06 '16 at 04:07
  • Possible duplicate of [Clone repository into GitHub](http://stackoverflow.com/questions/10346810/clone-repository-into-github) – Thilo Apr 06 '16 at 04:08
  • Suggestion: try `git remote add origin git@github.com:username/reponame.git`, followed by `git push --mirror` to your new github repo. STRONG RECOMMENDATION: do a trial "dry run" and test your "github migration" before deleting or changing anything on your local repo!!! See also: https://help.github.com/articles/cloning-a-repository/ – paulsm4 Apr 06 '16 at 04:09

1 Answers1

3

In any of the workstations where you have pulled the git repository, perform the following actions,

git remote add origin https://github.com/user/repo.git
git push --all
git push --tags

This SO question and answer might help.

Make sure you pull the latest code from the server before doing this. You may also do this in the "server".

The reason you can execute these commands from any of the machines is 'git' is a distributed version control system. This means every machine into which you have pulled a git repository has all the information necessary to re-build the repository in case the server crashes.

Community
  • 1
  • 1
Vijay Purush
  • 322
  • 1
  • 12