user3123109 user3123109 - 1 month ago 8
Git Question

How to copy a git repo with dependencies that are specific to that environment

I use a Mac at home and Windows at work.

I am working on Laravel project at home and pushed it to GitLab. I haven't adjusted any of the

.gitignore
files so when I copied the repo there were numerous dependencies and environment settings for the project that didn't push to GitLab.

So then I thought I would override the
.gitignore
files and add everything. This included all the dependencies and the env settings, but when I go to run it at work, it resulted in errors looking for dependencies specific to Mac.

So I guess I am trying to figure out how one typically clones a repo from computer to computer. The two methods I tried didn't really work.

Does one install the dependencies for the project first, in the case of Laravel
laravel new [use the same name for the project]
on the Windows computer? Or do you download the repo and then install the dependencies by rebuilding them probably with some command to reinstall dependencies?

Answer

So to make it work,

Do these steps.

  1. Run composer install or composer update on both systems.
  2. Modify .env files as per your database username and password defined.
  3. If you've some node dependencies then run npm update.
  4. If you're using gulp then don't forget to run gulp.

Don't modify anything apart from .env file to make it work on both the systems.

Feel free to comment if you face any kind of error. I've been using more than 2 places to code and continue development so yeah, this is the way.
Hope this helps. :)