Not able to redeploy the app after upgrading the heroku stack - heroku

We are in process of upgrading the heroku stack from 18 to 22. After clicking on upgrade while we are trying to redeploy the app we are getting the below error while doing git push:
error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'
We are following the below steps to redeploy:
$ heroku git:clone -a test
$ cd test
$ git add .
$ git commit -am "make it better"
$ git push heroku master
Also we have followed the below steps from CLI as well
To upgrade via the Heroku CLI, use the stack:set command on your production app:
heroku stack:set heroku-22 -a test
Setting stack to heroku-22... done
You will need to redeploy ⬢ for the change to take effect.
Run git push heroku main to trigger a new build on ⬢ .
git commit --allow-empty -m "Upgrading to heroku-22"
[master (root-commit) 89fea09] Upgrading to heroku-22
git push heroku master
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 185 bytes | 185.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: pathspec '.' did not match any file(s) known to git.
remote:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote:
To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c#bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.
We are getting the below error here:
remote: error: pathspec '.' did not match any file(s) known to git.
remote:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote:
To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c#bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.
Could you please help us in resloving the issue.

We are following the below steps to redeploy:
$ heroku git:clone -a test
First of all, you shouldn't be doing this:
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.
If this is part of your regular workflow, please adjust accordingly. Heroku is not a source code management platform.
Now, onto the problem:
src refspec master does not match any
You simply don't have a master branch.
Heroku builds from one of two branches: main (which is newer and slowly becoming the community standard default branch name) and master (legacy).
If you don't have a master branch, you almost certainly have a main branch that Heroku will happy build from:
git push heroku main
If you need to deploy from some other branch another-branch, you still need to push to main (or master) on Heroku:
git push heroku another-branch:main
Finally, please don't actually use "make it better" as a commit message. Spend some time making commit messages clear and meaningful. There is lots of good advice floating around about how you can do that.

Related

Heroku+BItbucket deploy: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart

I am now working on a website. I use heroku to run my server and use bitbucket as the version control tool. I setup a pipeline to deploy directly from bitbucket to heroku. But I keep getting an error like:
+ git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git HEAD
To https://heroku:57eb7889-7395-4a7e-bd95-1312a40b30d1#git.heroku.com/hidden-ocean-90048.git
! [rejected] HEAD -> master (non-fast-forward)
error: failed to push some refs to 'https://heroku:57eb7889-7395-4a7e-bd95-1312a40b30d1#git.heroku.com/hidden-ocean-90048.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I tried git pull and git pull -f but it doesn't work. Please help me.
You can push with -f like the below:
git push -f https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git HEAD

Merge staging repository bare repository after push via hooks (GIT, Windows, GitStack)

I have installed GitStack on Windows Server 2008, and for a given project created a bare repository to which I push from my local development environment. I'd like to set up a hook that causes my staging environment to merge the pushed changes automatically on every push.
I'd posted a previous bash script but have now updated this to the below:
#!/bin/sh
export GIT_WORK_TREE=F:\\inetpub\\project_name\\staging\\
export GIT_DIR=F:\\inetpub\\project_name\\staging\\.git
git pull origin master
And get the following error message:
remote: bash.exe: warning: could not find /tmp, please create!
remote: From F:/GitStack/repositories/project_name
remote: * branch master -> FETCH_HEAD
remote: error: unable to create directory for f:/inetpub/project_name/staging/.git/refs/remotes/origin/master
remote: ! c8f4278..80cbe73 master -> origin/master (unable to update local ref)
To http://me#mydomain.com:9999/project_name.git
c8f4278..80cbe73 master -> master
updating local tracking ref 'refs/remotes/origin/master'
I'm not sure where to go from here - any tips?
Try to run the GitStack service as an Administrator.

Getting error when trying to git push to remote branch (Heroku)

Hi I tried to push my local changes to heroku production but I am getting the following error
Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git push heroku-production master:master
To git#heroku.com:dailymuses.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#heroku.com:dailymuses.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The issue here is that when I tried to do a git pull, I was told that everything is up to date
Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git pull origin master
From github.com:mingyeow/Dailymuses-Server-Side
* branch master -> FETCH_HEAD
Already up-to-date.
What is the issue here and how can I resolve it?
Your push command is to remote heroku-production but your pull command is to origin. The non-fast-foward message means the history in your current repo differs from the Heroku remote; likely someone has pushed a branch with some merges or rebases.
I implore you to not use Heroku as the authoritative git remote. Assuming you are not, you can force push over the Heroku master branch to resolve this.
git push -f heroku-production master:master

"Heroku push rejected, no Cedar-supported app detected" when trying to upload a Sinatra app with an existing git repo

I have an existing git repo for my personal website, which I am porting to Sinatra (mainly for templating, it's a static site). I do NOT want to lose/reset this git repository.
When I try to push to Heroku, I get the error below. I have a config.ru file, a Gemfile, and a Gemfile.lock, along with some other stuff for Sinatra. Running rackup works, running bundle exec rackup works, and I didn't get any warnings from Heroku about missing dependencies.
Am I missing something? I can post the directory structure of my site if it would help (though it's close sourced).
~/Repos/website ➜ gp heroku master
Counting objects: 2836, done.
Compressing objects: 100% (2669/2669), done.
Writing objects: 100% (2836/2836), 3.48 MiB | 252 KiB/s, done.
Total 2836 (delta 481), reused 2117 (delta 155)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:APP_NAME_HERE.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:APP_NAME_HERE.git'
A Cedar app should recognise the config.ru file and create a web process for you, so it's possible that some essential file is not tracked by git. Check that config.ru, Gemfile and Gemfile.lock are all committed (you can use git status, but note that it will not output anything for ignored files so you should also check your .gitignore file).
If all the files are committed, you could also try specifying the command you want the web process to use in a Procfile. See the Heroku docs for more information:
Getting started with Ruby: Declare process types with Procfile
Declaring and Scaling Process Types with Procfile
Problem solved. I was working on a git branch especially for Heroku/Sinatra support, and it turns out I was running git push heroku master, which pushed local master to remote master. The master branch did not have a valid Heroku app. I assumed it would push the current local branch to the remote master branch, which is not the case. git push sinatra:master solved the issue.
For those who find that the accepted answer doesn't solve their problem, this related question may provide the solution: "Heroku push rejected, no Cedar-supported app detected" when trying to upload a Sinatra app with an existing git repo

Permanently added the RSA host key for IP address

Everybody,
I get an error when I run this command: "git push heroku master". The error log shows the following:
$ git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Rails or Rack app detected
To git#heroku.com:simple-earth-536.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#app_name.git'
Any idea what could cause this? I welcome any suggestions, thanks all.
This means that you are not in a rails application, such as if you are not in the correct directory.
Make sure you are actually in your apps directory.
rails myapp
cd myapp
This is the flow you should go through"
rails new_app
git init
git add .
git commit -m 'master'
heroku create
git push heroku

Resources