Given the Heroku/Github problems, I'm trying to use the Heroku CLI release instructions instead.
It worked fine for one of the environments in my pipeline, but it's not for the other. It returns "You appear to have cloned an empty repository." when I run the following.
heroku git:clone -a xxxxxx-release
Cloning into 'xxxxxx-release'...
warning: You appear to have cloned an empty repository.
There is plenty of code on this running environment. I took a look at this - https://help.heroku.com/XOBUHLKQ/why-do-i-see-a-message-you-appear-to-have-cloned-an-empty-repository-when-using-heroku-git-clone - but it says the answer has to do w/ buttons, which we don't use. I've tried to muddle there but can't seem to make a button for a current app, just a new one.
S.O. notes that I can try adding one file and committing it, but that also returns an error:
remote: ! Push rejected to xxxxxx-release.
remote:
To https://git.heroku.com/xxxxxx-release.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxxxxxx-release.git'
I'm now at a loss on how to release to this branch. Thanks in advance for any help.
CodePudding user response:
Don't clone from Heroku.
Since you've been deploying via GitHub you should already have a local copy. Just use that:
cd project-directory/
heroku git:remote -a <YOUR_APP_NAME> # Add a remote for your Heroku-hosted app
git push heroku # Assuming you're already on main and want to deploy that version
If, for whatever reason, you don't have a local copy, clone from GitHub then proceed as above.
Cloning / pulling from Heroku isn't meant to be part of your regular workflow:
A Heroku app’s Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. Do not use this repository as your app’s canonical “origin” repository. Instead, use your own Git server or a version control service such as GitHub.
And the reason you're getting an empty repository when you clone from Heroku is that GitHub deploys don't populate the Heroku-hosted repository:
Does the GitHub integration sync to my Heroku-hosted Git repo?
For apps with GitHub integration enabled, Heroku does not sync the contents of the GitHub repo to the Heroku-hosted repo. Instead, Heroku pulls source directly from GitHub.