I am using mojostratus hosting and have built up our site using Magento 2.3.4, Porto theme and various extensions. One thing I should have thought about was dev/prod staging using git. I wasn't working on it locally, just SSHing in when I needed to. Can someone please help me understand the workflow here? I'm relatively familiar with git and have used it on many other projects, just not with Magento 2. When I input git status through SSH, I get "fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)", so I'm assuming I need to initialize and create an empty repo to connect it to? All of the docs I've seen about this topic are related to cloning the master Magento 2 from their github to local and then going from there. My guess would be that I need to git init-connect to empty repo-clone to local(develop here)-create development branch on github- merge to my master branch when wanting changes to go into production-pull from mojostratus SSH. Am I close here?
Thanks for the advice,
It's because you have not setup git in your project, you must run :
then git will be initialised and then you need to add your repository.
later you should exclude vendor directory in your git (manage it via .gitignore) and don't push files which have local use, for ex: app/etc/env.php because that stores project specific values.
you can take reference from here :
Hope it helps !
Thanks for the reply. The link to the docs you sent is for if a project is hosted on Magento's Commerce Cloud, right? Our site is hosted on Magemojo and is using the open source(community) version of Magento 2.3.4. I think this makes a difference here. So, do you suggest that I initially make a repo and push everything without a .gitignore, then clone to my local machine? Can I use the Magento Cloud CLI without magento cloud commerce to create the different staging environments? I was under the impression that this will cost extra money and is part of a different plan. Still pretty confused and would love more advice!
Ignore the reference as it's for commerce cloud, do these steps :
1. create a repo on github.com .
2. run this command on your project setup : "git init" .
3. then you'll have all local changed files.
4. add github repository by command : "git remote add origin remote repository URL"
5. add the needful directories and files and push
That's it !
so, to recap, my project is currently on Magemojo, I do not have a local version yet. You suggest I make a repo from the hosted destination and then pull it to my local machine and create a dev branch, right?
Will I still be able to connect to the online magento database if I run it locally?
Yes, but the steps I share above will push the code to your repo with a master branch, then you will need to pull that master clone on local and then you can create branch from master branch, then you can manage it from local and live but DATABASE is not part of git, you have to take care of that, whatever changes you will do in admin on local, most of them will not be covered in git.
You have to manually change on live.
Ok, so a local production environment is mostly for any front-end programming related development, correct? If I won't be doing much customization, what is the point of a dev environment then?