0

My client has a Magento eCommerce website on a production server.

We now want to bring this existing website into a GIT repo.

We opted for using the hosted version of GitLab which is an open source GitHub clone. We opted to use the hosted version instead of self hosting in-house.

So my question right now is. How do I go about adding this existing codebase to a hosted GIT repo?

Should I:

  1. download the full site codebase to my local PC
  2. Make it a local GIT repo
  3. Then push the local repo to the remote GitLab server repo?

Or should I go a different route?


I have previously only used Git on small per project basis and never on a whole website like this!

JasonDavis
  • 48,204
  • 100
  • 318
  • 537
  • Yes, what you suggested sounds perfectly sensible. – naught101 Apr 27 '16 at 06:16
  • http://stackoverflow.com/questions/4658606/import-existing-source-code-to-github – Erik Ahlswede Apr 27 '16 at 06:17
  • well, I don't see the question has anything to do with hosted/self-hosting Git, nor has any relationship with website. What you need to do is simply: assume you have an empty Git repository (on Gitlab etc), how can you add files to it. – Adrian Shum Apr 27 '16 at 06:18
  • For which a normal clone -> add files -> commit -> push flow will work – Adrian Shum Apr 27 '16 at 06:18
  • @AdrianShum would I be running this from the server that currently has the code running live or from my local PC repo? End goal is to have a local PC Git repo of the site which I can push changes to a GitLab repo and then from there push to the production server. I am just a bit confused right now so far – JasonDavis Apr 27 '16 at 06:23
  • So I am not sure if I should download the production server code to my PC and build a local repo from it and then push it to the new remote GItlab Git repo. Or else if I should instead push the file/repo from the production server to the Gitlab remote repo and then pull it down to my local git repo. Currently no repo exists and the files exist only on the production server. – JasonDavis Apr 27 '16 at 06:26
  • I doubt if it can "push to production server". Probably what you need on that part is a periodic pull on your production server? – Adrian Shum Apr 27 '16 at 06:27
  • If it is not a concern for you, then starting with either side should have no big difference. – Adrian Shum Apr 27 '16 at 06:28
  • @AdrianShum got you, I see so both local repo and production site will both ull from the remote repo. Its been a while since I used Git on a big projects so wasn't getting the concept but that makes sense now, thanks. For getting initial files/repo to remote repo I think I can simply push or pull from my production server and then set it as the remote repo – JasonDavis Apr 27 '16 at 06:29
  • another common way is to set up a repo in your production server, and have a hook in your Gitlab repo, which automatically push to production server whenever someone pushed to your Gitlab repo. (Still, not much difference for you to start in either side imho) – Adrian Shum Apr 27 '16 at 07:21

0 Answers0