2

There is a Laravel project on shared hosting (HostGator). It means that the backend part of Laravel (everything but public directory) is located in the parent of public_html while its public directory is in public_html/public.

Now, I put Git in the backend part, but I do not know how to include Laravel public directory as Git does not see it.

What is the solution here? Two Git repos then use Git submodule? Not sure how this will work.

Or there is a better solution for such "Laravel on shared hosting" use-case?

sandalone
  • 41,141
  • 63
  • 222
  • 338

1 Answers1

3

You would be better off creating a symlink between your projects public directory and your document root( public_html/public).

ln -s /absolute_path_to/project/public   /absolute_path_to/public_html/public

This way you only need to have your project directory under version control.

Sapnesh Naik
  • 11,011
  • 7
  • 63
  • 98
  • I actually thought of that, but had no idea how would symlink be saved on the repo like Github or Bitbucket. – sandalone Jan 17 '18 at 11:55
  • 1
    @sandalone git can handle symlinks just fine. Take a look at this https://stackoverflow.com/questions/954560/how-does-git-handle-symbolic-links – Sapnesh Naik Jan 17 '18 at 11:57