0

First of all, I am well aware that there is already an answered question with an almost identical title:

How to link a folder with an existing Heroku app

Why am I asking the same question:

I tried to follow it through, but I really don't understand half of the stuff mentioned there, and randomly executing some of the commands didn't work for me - and I have obviously no idea why.

I use Heroku and Git because there is no other way for me to use the tool that I need (oTree, in case anyone is interested), and I am just by far not well enough educated to understand what happens there and why. I have a physics/economics background, and programming for me mostly still happens in one file, from top to bottom. I would therefore really appreciate it, if this question is a) allowed and b) answered without too many complicated words.

I will just explain what I want to happen, and I guess that there is probably a very simple solution to it.

The situation:

I have a folder on my local computer which I called "maxims-sandbox". I also have an app on Heroku called "maxims-sandbox". What I want to do, is to put all the files in the folder into the heroku app. (What I would actually do, is just copy files from the folder in which I am writing a new app, and then upload it. I think there is probably a way to upload everything directly from the folder to the "maxims-sandbox", but I think it is probably too complicated.)

What I can do so far:

I have a folder on my local computer which I called "lecture-ulm". I also have an app on Heroku called "lecture-ulm". When I change something in my local folder, I then do:

git add .
git commit -m "whatever"
git push heroku master
[some more app scific commands]

Magic happens, and everything is online.

My possible workaround:

I can create a new Heroku app, then copy everything in the newly created folder, and then upload everything with the magic commands. But I will probably run out of names quickly, and it doesn't really feel right.

So my question is - what do I have to do, so that I can use the three magic commands to send stuff into the cloud from my sandbox folder?

Maxim Moloshenko
  • 336
  • 3
  • 17
  • is your question about code, static images? or user-uploaded media? – Denis Cornehl Nov 20 '19 at 05:36
  • I am sorry, I don't really understand your question? My best summary is "send stuff into the cloud". But I solved it anyway now, just keeping the question in case someone stumbles upon it. – Maxim Moloshenko Nov 26 '19 at 15:04

1 Answers1

0

I think I solved it:

  1. Go to the app folder
  2. Open command line tool
  3. Enter the following:
git init
heroku git:remote -a maxims-sandbox (<- your app name on heroku)

You can now push code to Heroku (almost) like usual.

git add .
git commit - m "whatever"
git push heroku master --force

You can now push your code to the sandbox, but you always need --force.

No idea how to get rid of it, but I am happy since it works. :)

Maxim Moloshenko
  • 336
  • 3
  • 17
  • you shouldn't need `--force` here. you can omit the `init` and `git:remote` commands, and only do the others on every change. A GIT tutorial (any) could help you understand better. – Denis Cornehl Nov 20 '19 at 05:38