Closed 1aurabrown closed 6 years ago
Local Branch is supposed to refer to where you have your Grav instance with GitSync installed. In there you cloned your git repository and possibly changed the branch to something else (ie, production).
origin/master
is the remote where your changes will be pulled from and pushed to.
So if I am picturing correctly your setup, on heroku you should be using a production
branch and if you make changes in Grav, they get pushed in github to origin/master.
Is this not what is happening?
Hmm maybe I am confused. I want the opposite to happen--I don't need multiple branches on heroku, I have two separate apps for staging and production set up there. I want one repo on github with two branches -- one which syncs with the staging app, and one which syncs with production app.
Can this be done?
With these settings I receive this error:
It can, I think what you want is:
production
origin
production
Also keep in mind that you want to make sure you are in the right branch on heroku.
Go in the user folder of Grav and via CLI run a git branch
to see which is selected.
@w00fz thanks for the help. Is there any reason I can't use master on heroku?
You can use master
. Master is just another branch, the point is that you need to setup gitsync to match both the remote and local branching you have.
Usually this is master
, origin
, master
. I guess I'm trying to understand how your setup is because it's not entirely clear to me.
I'm going to shoot a few questions your way:
user
folder under the Grav installation, what is the branch setup in there? master
or production
?master
and production
branches there?master
or production
?Also just so it is clear: Heroku = Local Github = Remote
Even though from both yours and mine perspective they are both remote. But they are local and remote from Grav / GitSync perspective.
Hi again and thanks for the help!
I don't think heroku supports git on their servers other than providing a remote to push to for deploy. For this reason, both apps on heroku are always on their local 'master' (or at least it returns to master each time the app re-starts). I wanted them each to be able to sync to a separate branch of a single git repo (remote), ie 'master' and 'production, or 'staging' and 'production'.
In practice it is probably sufficient to only sync the production app, between local 'master' and remote 'master', so this is a fine solution for now.
Another complication of heroku's ephemeral file system is that each time the web app is restarted, it returns to the state it was in at last deploy--this means any changes to the file system which were not present in the deployed commit are reverted. Therefore it is necessary to persist changes to the user folder elsewhere, for example on github. I hadn't thought about this before releasing the app on heroku, and I am wondering what other people's solution has been, or if git sync is the best option.
Thanks! Laura
Unless I misunderstand what 'Local' and 'Remote' refer to in the plugin settings, I believe that in the Plugin settings interface, Local Branch actually affects which branch on github.com is used for syncing, and Remote Branch refers to the branch on the server. I discovered this because I wanted to sync the production instance of my app with a branch in the repo called 'production' and sync the staging app with master. Entering this according to the labels resulted in an error stating that the remote branch at my repot on github could not be found. However when I inverted the entries, it worked. I certainly don't have a local branch on heroku called 'production', and I definitely do on github. I havent looked at the code, but it seems obvious that the branch names are getting pulled from the wrong fields/the fields are mislabeled.