-1

Per advise from Heroku - push subtrees to different apps I'm trying to push a local dist folder to one of my Heroku Node apps.

However, I can't get it to work for my case. I issued first the command:

git remote add myherokuapp https://git.heroku.com/myherokuapp.git

(https://git.heroku.com/myherokuapp.git is the git URL for my app from the Heroku dashboard)

followed by the command:

git subtree push --prefix dist myherokuapp master 

which supposedly should push a local dist folder to the root of the myherokuapp file system.

I see in the console that this last command pushes over 500 files to some destination and completes without error. But when I check through bash the file system for myherokuapp, it is empty - no dist folder.

What could be the reason for this problem?

phd
  • 82,685
  • 13
  • 120
  • 165

1 Answers1

0

push a local dist folder to the root

Exactly that; now all files and directories that are locally in dist copied to the root directory at the remote, not to dist. You cannot push dist to dist with git subtree. Either you need dist/dist locally or a separate branch that only has dist and you push it with git push myherokuapp distbranch:master.

phd
  • 82,685
  • 13
  • 120
  • 165
  • Thanks for your support! However, not sure I understand. When I issue "ls" in bash for the app, it returns empty - no folders and no files at all. – Michael Scheible Feb 26 '20 at 23:33
  • That's strange. `ls -lA`? – phd Feb 26 '20 at 23:38
  • `ls -lA` returns "total 0". – Michael Scheible Feb 27 '20 at 09:28
  • Totally empty. Very strange. Either you pushed to a different application or you run bash in a different app. – phd Feb 27 '20 at 09:30
  • Yes, these might be the obvious reasons. One speciality: The remote repository that I would like to push to is forked (via GitHub) from a repo of another GitHub user. Normally that dist folder (through GItHub, without Heroku) is pushed first from either my or that other user's local computer to that repo of the other user. Could that special setup cause problems with the above git subtree to the forked repo on Heroku? – Michael Scheible Feb 27 '20 at 09:48
  • Re. the bash command: I enter `heroku run bash --app myherokuapp`, so I guess I do the bash command correctly. The other possibility, that it gets wrongly pushed to some other place is more likely. – Michael Scheible Feb 27 '20 at 09:56
  • I have meanwhile worked around this issue, by doing my build on Heroku instead of building locally and pushing the resulting dist folder to Heroku. – Michael Scheible Jul 24 '20 at 07:30